I have a snippet in my .zshrc that defines compdef kubecolor=kubectl if kubecolor is installed:
if (( $+commands[kubecolor] )); then
alias k=kubecolor
compdef kubecolor=kubectl
export KUBECOLOR_OBJ_FRESH=12h # highlight resources newer than 12h
else
alias k=kubectl
fi
This gives the following error: compdef: unknown command or service: kubectl. If I execute the compdef kubecolor=kubectl command in the interactive shell after it's been initialized, I don't get this error.
kubectl is installed by google-cloud-sdk, which is installed via Homebrew:
$ which kubectl
/opt/homebrew/share/google-cloud-sdk/bin/kubectl
I have a snippet in my .zshrc that defines
compdef kubecolor=kubectl
if kubecolor is installed:This gives the following error:
compdef: unknown command or service: kubectl
. If I execute thecompdef kubecolor=kubectl
command in the interactive shell after it's been initialized, I don't get this error.kubectl
is installed by google-cloud-sdk, which is installed via Homebrew: