diff --git a/.functions/kubernetes.sh b/.functions/kubernetes.sh index eb66cd7..0c6fad0 100644 --- a/.functions/kubernetes.sh +++ b/.functions/kubernetes.sh @@ -13,6 +13,9 @@ function kubernetes_configs(){ for file in $(find "${KUBE_CONFIG_DIR}" -type f -name "$KUBE_CONFIG_EXTENTION"); do export KUBECONFIG="$file:$KUBECONFIG" done + if [[ $(command -v kubectl) ]];then + complete -W "$(kubectl config get-contexts -o name)" kuc + fi } kubernetes_configs @@ -25,9 +28,3 @@ function kuc(){ # use kubernetes context kubectl config use-context "$1" } - -#bash completion for function kuc -if [[ $(command -v kubectl) ]];then - complete -W "$(kubectl config get-contexts -o name)" kuc -fi -