From 10731104d210e82a20d337eeebc636d9fe59456f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 17 Oct 2022 11:39:36 +0200 Subject: Reformat zsh files --- user/zsh/zshrc | 57 +++++++++++++++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 30 deletions(-) (limited to 'user/zsh/zshrc') diff --git a/user/zsh/zshrc b/user/zsh/zshrc index c63dace2..d843ce2f 100644 --- a/user/zsh/zshrc +++ b/user/zsh/zshrc @@ -56,13 +56,13 @@ ds () { du -hd1 "$@" | $sort -h } zle-upify() { - buf="$(echo "$BUFFER" | sed 's/[ |]*$//')" - tmp="$(mktemp)" - eval "$buf |& up -o '$tmp' 2>/dev/null" - cmd="$(tail -n +2 "$tmp")" - rm -f "$tmp" - BUFFER="$BUFFER | $cmd" - zle end-of-line + buf="$(echo "$BUFFER" | sed 's/[ |]*$//')" + tmp="$(mktemp)" + eval "$buf |& up -o '$tmp' 2>/dev/null" + cmd="$(tail -n +2 "$tmp")" + rm -f "$tmp" + BUFFER="$BUFFER | $cmd" + zle end-of-line } zle -N zle-upify @@ -100,34 +100,31 @@ else AGKOZAK_PROMPT_DIRTRIM=0 AGKOZAK_LEFT_PROMPT_ONLY=${+SSH_CLIENT} - if [[ -z $SSH_CLIENT ]] - then - check_kubectl_context () { - if [[ "$PWD" =~ satoshipay ]] + check_kubectl_context () { + if [[ "$PWD" =~ satoshipay ]] + 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 - kubectl_context=$(kubectl config current-context) - kubectl_namespace=$(kubectl config view -o jsonpath="{.contexts[?(@.name==\"${kubectl_context}\")].context.namespace}") - if [[ $kubectl_context =~ production ]] + kubectl_colour=red + kubectl_release=satoshipay-${kubectl_namespace} + else + kubectl_colour=yellow + if [[ -z $mr ]] then - kubectl_colour=red - kubectl_release=satoshipay-${kubectl_namespace} + kubectl_release=satoshipay-${kubectl_namespace}-staging else - kubectl_colour=yellow - if [[ -z $mr ]] - then - kubectl_release=satoshipay-${kubectl_namespace}-staging - else - kubectl_release=story-${mr}-${kubectl_namespace} - fi + kubectl_release=story-${mr}-${kubectl_namespace} fi - prompt_context="%F{$kubectl_colour}[${kubectl_context}:${kubectl_namespace}]%f" - else - prompt_context= fi - } - precmd_functions+=(check_kubectl_context) - AGKOZAK_CUSTOM_RPROMPT='${prompt_context}%(3V.%F{${AGKOZAK_COLORS_BRANCH_STATUS}%3v%f.)' - fi + prompt_context="%F{$kubectl_colour}[${kubectl_context}:${kubectl_namespace}]%f" + else + prompt_context= + fi + } + precmd_functions+=(check_kubectl_context) + AGKOZAK_CUSTOM_RPROMPT='${prompt_context}%(3V.%F{${AGKOZAK_COLORS_BRANCH_STATUS}%3v%f.)' fi export FZF_CTRL_T_COMMAND='(fd --hidden --follow --exclude ".git" .) 2> /dev/null' -- cgit 1.4.1