Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Alias command /and/ flags



On Tue, Nov 22, 2016 at 10:31 AM, Yuri D'Elia <wavexx@xxxxxxxxxx> wrote:
>
> Any reason:
>
>   alias "cmd flag"="cmd2 flag2"
>
> shouldn't work at least in principle?

Sorry, no.  Aliases (even "alias -g" global ones) operate on shell
syntax words, which in the most straightforward case means strings of
non-whitespace separated by whitespace.  You can't create an alias for
something that has any word-delimiting space in the middle of it.

> I can think of a way by defining a "cmd" function and do the checking on
> the arguments myself

This is probably going to be the simplest option that will cover your
requirements.  There are also various ways to attack this through
custom ZLE widgets but that would get even more esoteric.



Messages sorted by: Reverse Date, Date, Thread, Author