summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--zsh/.config/zsh/.zshrc6
1 files changed, 4 insertions, 2 deletions
diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc
index 18f04a9..db108ef 100644
--- a/zsh/.config/zsh/.zshrc
+++ b/zsh/.config/zsh/.zshrc
@@ -213,12 +213,14 @@ else
     if [[ "$PWD" =~ /kubernetes ]]
     then
       kubectl_context=$(kubectl config current-context)
+      kubectl_namespace=$(kubectl config view -o jsonpath="{.contexts[?(@.name==\"${kubectl_context}\")].context.namespace}")
       if [[ $kubectl_context =~ production ]]
       then
-        prompt_context="%F{red}[${kubectl_context}]%f"
+        kubectl_colour=red
       else
-        prompt_context="%F{yellow}[${kubectl_context}]%f"
+        kubectl_colour=yellow
       fi
+        prompt_context="%F{$kubectl_colour}[${kubectl_context}:${kubectl_namespace}]%f"
     else
       prompt_context=
     fi