mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-09-09 12:29:07 +00:00
13 lines
383 B
Bash
13 lines
383 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 | awk '{print $2}' | tail -n +2)))"
|
|
else
|
|
_arguments "1: :($(kubectl config get-contexts | awk '{print $2}' | tail -n +2))"
|
|
fi
|