Use kubectl-ctx instead of self-built cx

This commit is contained in:
dabruh 2022-11-10 15:23:27 +01:00
parent 7d2f08019a
commit 96c8473efe
2 changed files with 1 additions and 12 deletions

View File

@ -15,7 +15,7 @@ alias \
# Kubernetes things
alias \
ctx="kubectl ctx" \
cx="kubectl ctx" \
f='flux' \
h='helm' \
k='kubectl' \

View File

@ -1,11 +0,0 @@
#!/bin/bash
# cx - Kubernetes context switcher
LAST=/tmp/last_kube_context
CURR="$(kubectl config current-context)"
[[ -z "$1" ]] && kubectl config get-contexts && exit
[ ! -f $LAST ] && echo "$CURR" >$LAST
[[ "$1" == "-" ]] && USE="$(cat $LAST)" || USE="$1"
[[ "$CURR" != "$USE" ]] && echo "$CURR" >$LAST
kubectl config use-context "$USE"