Add support for `cmd.exe` (experimental)
See #218.
This PR adds experimental support for cmd.exe using the following Batch techniques:
- DOSKEY macros
for /fwith disappearing carets- "smart" percent characters
Most of the work was done in a0c6535 - % characters have different meanings depending on the context in which the code is interpreted (command-line vs script), thus the beginning of the template file introduces a macro used to escape them regardless of the situation - even in for statements.
While working on this I had to fix path normalization on Windows in bc947f4, i.e. patching drive letter prefixes to always be uppercase (as that's how the underlying API expects them to be, even though cmd.exe will happily return an unnormalized component from volume path environment variable). A similar problem was encountered in rust-analyzer, which made me provide a fix there. To offset the potential overhead I've bumped dunce to 1.0.4 in 2fdde1c, though most of the changes there are related to licensing and packaging.
To test this, zoxide init cmd is piped into cmd.exe - anything on stderr means failure, e.g.:
')' is not recognized as an internal or external command,
operable program or batch file.
It is ready.
This is awesome! I'm learning Batch as I review this, so forgive the intermittent comments.