let kubectl support double dashes which signfies positional parameters only

This commit is contained in:
hophacker 2020-03-03 12:24:11 +08:00
parent c461c1dea8
commit ec6ec688e0

View File

@ -254,14 +254,18 @@ function kubectl() {
DEBUG=true
shift
;;
--)
finalopts+=("$@")
break
;;
*)
finalopts+=($1)
shift
;;
esac
done
[[ $DEBUG == "true" ]] && echo "kubectl $finalopts --kubeconfig=$HOME/.kube/${KCONTEXT}_config"
command kubectl $finalopts --kubeconfig=$HOME/.kube/${KCONTEXT}_config
[[ $DEBUG == "true" ]] && echo "kubectl --kubeconfig=$HOME/.kube/${KCONTEXT}_config $finalopts"
command kubectl --kubeconfig=$HOME/.kube/${KCONTEXT}_config $finalopts
}
function stern {
KCONTEXT=${KCONTEXT:-gcloud}