It's easy to do a one word alias in ZSH.
alias ll='ls -lah'
Is there a way to do two word aliases with Zsh, so that both words are parsed as part of the same alias? I'd mostly like to use it for typo fixes.
alias 'gits t'='git st'
Simple aliases are a short form of a long command. To set up a simple alias, edit the ~/. zshrc file using your text editor and add an alias at the bottom. It is good to keep all your aliases in a single section of the file to avoid confusion and ease of edit.
Try this:
alias func='gits t'
func() {
'gits t'='git st'
}
more info here about Zsh alias functions:
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With