1
0
Fork 0

add alias and prompt display for kubectl context management

This commit is contained in:
Massaki Archambault 2024-07-03 11:56:14 -04:00
parent 2940f72eff
commit 3673398c08
2 changed files with 4 additions and 1 deletions

View File

@ -28,6 +28,9 @@ alias browsh="docker run --rm -it browsh/browsh"
# kube # kube
alias netshoot="kubectl run tmp-shell --rm -i --tty --image nicolaka/netshoot -- /bin/bash" alias netshoot="kubectl run tmp-shell --rm -i --tty --image nicolaka/netshoot -- /bin/bash"
alias kubectl="kubecolor" alias kubectl="kubecolor"
alias k="kubecolor"
alias kctx="kubectl config use-context"
alias kns="kubectl config set-context --current --namespace"
compdef kubecolor=kubectl compdef kubecolor=kubectl

View File

@ -86,7 +86,7 @@ prompt_cmd() {
# kubernetes context # kubernetes context
if which kubectl &>/dev/null; then if which kubectl &>/dev/null; then
local kubectl_context="%{$FG[008]%}[$(kubectl config current-context)] " local kubectl_context="%{$FG[008]%}[$(kubectl config current-context)|$(kubectl config view --minify -o jsonpath='{..namespace}')] "
fi fi
# name@hostname # name@hostname