Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for k8s context #148

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions agnoster.zsh-theme
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ typeset -aHg AGNOSTER_PROMPT_SEGMENTS=(
prompt_status
prompt_context
prompt_virtualenv
prompt_kubecontext
prompt_dir
prompt_git
prompt_end
Expand Down Expand Up @@ -142,6 +143,20 @@ prompt_virtualenv() {
fi
}

prompt_kubecontext() {
local env='';

if [[ -n $KUBE_PS1_CONTEXT ]]; then
env="$KUBE_PS1_SYMBOL_DEFAULT$KUBE_PS1_SEPARATOR$KUBE_PS1_CONTEXT$KUBE_PS1_DIVIDER$KUBE_PS1_NAMESPACE"
fi

if [[ -n $env ]]; then
color=magenta
prompt_segment $color $PRIMARY_FG
print -Pn " $env "
fi
}

## Main prompt
prompt_agnoster_main() {
RETVAL=$?
Expand Down