mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-07-05 19:46:16 +00:00
Fix context discovery
This commit is contained in:
parent
d1c04555f4
commit
d04543ffef
@ -2,7 +2,7 @@ _kube_contexts()
|
|||||||
{
|
{
|
||||||
local curr_arg;
|
local curr_arg;
|
||||||
curr_arg=${COMP_WORDS[COMP_CWORD]}
|
curr_arg=${COMP_WORDS[COMP_CWORD]}
|
||||||
COMPREPLY=( $(compgen -W "- $(kubectl config get-contexts | awk '{print $2}' | tail -n +2)" -- $curr_arg ) );
|
COMPREPLY=( $(compgen -W "- $(kubectl config get-contexts --output='name')" -- $curr_arg ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
complete -F _kube_contexts kubectx
|
complete -F _kube_contexts kubectx
|
@ -6,7 +6,7 @@ if [ -f "$KUBECTX" ]; then
|
|||||||
# show '-' only if there's a saved previous context
|
# show '-' only if there's a saved previous context
|
||||||
PREV=$(cat "${KUBECTX}")
|
PREV=$(cat "${KUBECTX}")
|
||||||
_arguments "1: :((-\:Back\ to\ ${PREV} \
|
_arguments "1: :((-\:Back\ to\ ${PREV} \
|
||||||
$(kubectl config get-contexts | awk '{print $2}' | tail -n +2)))"
|
$(kubectl config get-contexts --output='name')))"
|
||||||
else
|
else
|
||||||
_arguments "1: :($(kubectl config get-contexts | awk '{print $2}' | tail -n +2))"
|
_arguments "1: :($(kubectl config get-contexts --output='name'))"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user