OhMyZsh is not running the command associated with an alias

4/12/2019

I want to delete a helm instance using an alias, to which I can append a named instance and this is added to the command and run.

I have the following in my .zshrc file

alias helmd='function __helmd() {echo "helm delete $* --tiller-namespace=this-is-for-stack-uat --purge"; unset -f __helmd; }; __helmd'

When I type

helmd delete-this-instance

I get

helm delete delete-this-instance --tiller-namespace=this-is-for-stack-uat --purge

Which is the expected output, however the helm delete command isnt run, instead it prints the string out and then shows the cursor so I can start typing commands. What I want it to do is run the function so that the instance is deleted.

-- will
alias
bash
kubernetes-helm
oh-my-zsh

1 Answer

4/29/2019

As @Aaron mentions, just run the command, don't echo it.

alias helmd='function __helmd() {helm delete $* --tiller-namespace=this-is-for-stack-uat --purge; unset -f __helmd; }; __helmd'

-- switchboard.op
Source: StackOverflow