mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-10-21 19:02:13 +00:00
13 lines
351 B
Bash
13 lines
351 B
Bash
#compdef kubectx
|
|
|
|
KUBECTX="${HOME}/.kube/kubectx"
|
|
PREV=""
|
|
if [ -f "$KUBECTX" ]; then
|
|
# show '-' only if there's a saved previous context
|
|
PREV=$(cat "${KUBECTX}")
|
|
_arguments "1: :((-\:Back\ to\ ${PREV} \
|
|
$(kubectl config get-contexts --output='name')))"
|
|
else
|
|
_arguments "1: :($(kubectl config get-contexts --output='name'))"
|
|
fi
|