chrisant996 / clink

Bash's powerful command line editing in cmd.exe
https://chrisant996.github.io/clink/
GNU General Public License v3.0
3.62k stars 143 forks source link

the new `os.setalias` ignore the flags and args #602

Closed silisium closed 6 months ago

silisium commented 6 months ago

if i have let say:

os.setalias('grep', 'rg')

and run grep --help, i get the output you normally get when running rg without flags, not the help output. i had to do this to make it work:

os.setalias('grep', 'rg'  .. ' $*')

which i think should be done implicitly by os.setalias

chrisant996 commented 6 months ago

Aliases are part of the OS.

Run doskey /? to learn more.

The syntax of aliases is well defined, and documented.

If you want to pass the full list of arguments in a specific spot, then you must use $*.

Simply,

os.setalias('grep', 'rg $*')

The alias syntax enables you to also choose to not include args, or to put specific ones in specific spots, e.g. xyz --port="$2" verb $1.