Closed char101 closed 1 month ago
Yes. See the documentation at Saved Command History. The "Note" explains the behavior.
If the first word in the line matches one of the words in the history.dont_add_to_history_cmds
I would expect that words are separated by whitespaces not dot though.
I think the only command that can contain dot is the ECHO
command. Thus ECHO.
is still ECHO
but history.cmd
is a different thing with history
.
I think rather than isalnum
, the check should compare the char to space or tab
If the first word in the line matches one of the words in the history.dont_add_to_history_cmds
I would expect that words are separated by whitespaces not dot though.
I think the only command that can contain dot is the
ECHO
command. ThusECHO.
is stillECHO
buthistory.cmd
is a different thing withhistory
.
I can understand that desire.
That's specifically not how this is designed. It's designed to intentionally ignore extensions (like argmatchers do in Clink), so that one doesn't have to add foo
, foo.exe
, foo.bat
, foo.cmd
, foo.pl
, etc to cover all the variations of a doskey alias or built-in command or scripts or external programs that shouldn't be added to history.
It's been like this for 4 years. Since there hasn't been any feedback about it until now, changing it at this point introduces risk of breaking other people's usage preferences. Every time I've made a change like this that seemed simple and like "what could possibly go wrong?" multiple regressions were caused unexpectedly.
I'm potentially open to changing the behavior someday, but that's risky and isn't something I would do quickly or lightly.
One workaround you could do is to create a different alias such as doskey hist="c:\program files\clink\clink_x64.exe" history $*
, and change clink.dont_add_to_history_cmds
to hist exit
. Then it wouldn't prevent history.cmd
from being added to the history, and you could use hist
instead of history
for listing/manipulating the history.
I recognize it isn't the same as what you'd like. It's the closest workaround I can think of, though.
Thank you for the explanation.
I just realize that for normal executable the extension part is optional, thus typing cmd
is the same as typing cmd.exe
, cmd.cmd
, and so on, so I can understand that ignoring the extension is correct in this case.
I think I will choose the simplest option and set history.dont_add_to_history_cmds
to empty list.
I just realize that for normal executable the extension part is optional, thus typing
cmd
is the same as typingcmd.exe
,cmd.cmd
, and so on, so I can understand that ignoring the extension is correct in this case.
Yes, that's why it's designed to behave the way it currently does.
I agree that on a case by case basis, there can be particular usages where the behavior feels more like a drawback than a benefit. I think that making the behavior more complicated adds more cost and documentation and complexity than is really worth it for this minor convenience feature (e.g. more complicated behavior could allow regular expressions, or conditionally allow ignoring extensions or paths, or etc).
Clearing the list seems like a good compromise.
Hi,
When running commands with name
history
, e.g.history.cmd
,history.py
, it is always excluded from the command history.