sam: Echo command/context on k

This commit is contained in:
Chandler Swift 2026-02-10 10:28:50 -06:00
parent a0a3e0f720
commit 052854db38
No known key found for this signature in database
GPG key ID: B123483B24A4D579

View file

@ -142,7 +142,16 @@
initExtra = ''
# https://kubernetes.io/docs/reference/kubectl/quick-reference/#bash
source <(kubectl completion bash)
alias k=kubectl
k() {
if [[ -t 1 ]]; then # stdout is a terminal
tput dim # Konsole's default theme requires some adjustment
printf "$ kubectl --context %q" "$(kubectl config current-context 2>/dev/null)"
printf " %q" "$@"
echo
tput sgr0
fi
kubectl "$@"
}
complete -o default -F __start_kubectl k
'';
};