summary refs log tree commit diff stats
path: root/zsh
diff options
context:
space:
mode:
Diffstat (limited to 'zsh')
-rw-r--r--zsh/.config/zsh/.zshrc16
1 files changed, 16 insertions, 0 deletions
diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc
index 5265d1f..6effdeb 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] ]]