mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-09-11 21:38:58 +00:00
13 lines
357 B
Bash
13 lines
357 B
Bash
#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
|