diff options
-rw-r--r-- | user/zsh/.config/zsh/.zshrc | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/user/zsh/.config/zsh/.zshrc b/user/zsh/.config/zsh/.zshrc index 23219e75..d2ed1807 100644 --- a/user/zsh/.config/zsh/.zshrc +++ b/user/zsh/.config/zsh/.zshrc @@ -87,29 +87,22 @@ else AGKOZAK_LEFT_PROMPT_ONLY=${+SSH_CLIENT} check_kubectl_context () { - if [[ "$PWD" =~ /kubernetes ]] + if [[ "$PWD" =~ /kubernetes || "$PWD" =~ /monorepo ]] then - git_branch=$(git rev-parse --abbrev-ref HEAD | tr '[:upper:]' '[:lower:]') kubectl_context=$(kubectl config current-context) kubectl_namespace=$(kubectl config view -o jsonpath="{.contexts[?(@.name==\"${kubectl_context}\")].context.namespace}") - case $git_branch in - staging) - kubectl_release=satoshipay-${kubectl_namespace}-staging - ;; - production) - kubectl_release=satoshipay-${kubectl_namespace} - ;; - master) - kubectl_release= - ;; - *) - kubectl_release=story-${git_branch}-${kubectl_namespace} - esac if [[ $kubectl_context =~ production ]] then kubectl_colour=red + kubectl_release=satoshipay-${kubectl_namespace} else kubectl_colour=yellow + if [[ -z $mr ]] + then + kubectl_release=satoshipay-${kubectl_namespace}-staging + else + kubectl_release=story-${mr}-${kubectl_namespace} + fi fi prompt_context="%F{$kubectl_colour}[${kubectl_context}:${kubectl_namespace}]%f" else |