diff options
author | Alan Pearce | 2018-12-19 11:47:21 +0100 |
---|---|---|
committer | Alan Pearce | 2018-12-19 11:47:21 +0100 |
commit | 958131271a6f82f1d6cf22cdbb6ad6742d34d4c8 (patch) | |
tree | d341e276da3586e276c9ca77cc79b063128a2521 /zsh | |
parent | bce46573aedafe5a484b5bf3d54dea1f18c53204 (diff) | |
download | nixfiles-958131271a6f82f1d6cf22cdbb6ad6742d34d4c8.tar.lz nixfiles-958131271a6f82f1d6cf22cdbb6ad6742d34d4c8.tar.zst nixfiles-958131271a6f82f1d6cf22cdbb6ad6742d34d4c8.zip |
zsh: Add kube context to prompt
Diffstat (limited to 'zsh')
-rw-r--r-- | zsh/.config/zsh/.zshrc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 5265d1fa..6effdebf 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -207,6 +207,22 @@ then else AGKOZAK_PROMPT_DIRTRIM=0 + check_kubectl_context () { + if [[ "$PWD" =~ /kubernetes ]] + then + kubectl_context=$(kubectl config current-context) + if [[ $kubectl_context =~ production ]] + then + prompt_context="%F{red}[${kubectl_context}]%f" + else + prompt_context="%F{yellow}[${kubectl_context}]%f" + fi + else + prompt_context= + fi + } + precmd_functions+=(check_kubectl_context) + AGKOZAK_CUSTOM_RPROMPT='${prompt_context}%(3V.%F{${AGKOZAK_COLORS_BRANCH_STATUS}%3v%f.)' fi if [[ -n $commands[fzf] ]] |