zsh: Add kubernetes release detection
Alan Pearce alan@alanpearce.eu
Sat, 23 Mar 2019 13:27:28 +0100
1 files changed, 14 insertions(+), 0 deletions(-)
jump to
M zsh/.config/zsh/.zshrc → zsh/.config/zsh/.zshrc
@@ -218,8 +218,22 @@ check_kubectl_context () { if [[ "$PWD" =~ /kubernetes ]] then + git_branch=$(git rev-parse --abbrev-ref HEAD) 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