Two word alias in zsh

Try this:

alias func='gits t'
func() {
    'gits t'='git st'
}

more info here about Zsh alias functions:

  • http://zsh.sourceforge.net/Doc/Release/Shell-Grammar.html#Aliasing

The same as in plain bash:

$ cd
$ vim .zshrc
...
tg() {
    if [ -z "$1" ]; then
        echo "Use correct second argument: apply/destroy/plan/etc"
    else
        if [ "$1" = "0all" ]; then
            terragrunt destroy -auto-approve && terragrunt apply -auto-approve
        elif [ "$1" = "0apply" ]; then
            terragrunt apply -auto-approve
        elif [ "$1" = "0destroy" ]; then
            terragrunt destroy -auto-approve
        else
            terragrunt "$@"
        fi
    fi
}
...

Don't forget to reread file:

$ source .zshrc

And after use e.g.:

$ tg 0apply

Tags:

Alias

Zsh