Last active
January 18, 2019 06:35
-
-
Save vainikkaj/c2656abb3f54b58d293b3d7ed6ce9b74 to your computer and use it in GitHub Desktop.
kubectx zsh completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#compdef kubectx kctx=kubectx | |
local KUBECTX="${HOME}/.kube/kubectx" | |
PREV="" | |
if [ -f "$KUBECTX" ]; then | |
# show '-' only if there's a saved previous context | |
local PREV=$(cat "${KUBECTX}") | |
_arguments "1: :(- | |
$(kubectl config get-contexts --output='name'))" | |
else | |
_arguments "1: :($(kubectl config get-contexts --output='name'))" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment