Can I add a custom command automatically after a command using the lua script? #328
-
I want to pipe stdout and stderr into a program, the following command works. cmd(I am using git): ls 2>&1 | less output: bin
config
git
registry
(END) Can i and How do i write a lua script to automatically add the following commands |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
clink.onfilterinput(function (line)
if line == 'ls' then
return 'ls 2>&1 | less', false
end
end) |
Beta Was this translation helpful? Give feedback.
-
Clink isn't needed for the stated situation. You could use
I forget offhand whether There are many ways to do this sort of thing with doskey aliases. Doskey is part of the Windows OS. Looking up documentation and examples for doskey should help. |
Beta Was this translation helpful? Give feedback.
Clink isn't needed for the stated situation. You could use
doskey
to define an alias.doskey ls=ls $* 2^>^&1 ^| less
I forget offhand whether
^
will successfully escape the redirection symbols when defining an alias.There are many ways to do this sort of thing with doskey aliases.
Doskey is part of the Windows OS. Looking up documentation and examples for doskey should help.