Added hability to switch to a context using a partial name

This commit is contained in:
Jordi Prats 2021-11-15 20:05:49 +01:00
parent 207dd606bb
commit 6e0a1591e0

View File

@ -108,7 +108,11 @@ save_context() {
}
switch_context() {
$KUBECTL config use-context "${1}"
if [ "$(get_contexts | grep -c "${1}")" -eq 1 ]; then
$KUBECTL config use-context "$(get_contexts | grep "${1}")"
else
$KUBECTL config use-context "${1}"
fi
}
choose_context_interactive() {