From 9836aebe672159622193f14a89eedc38ccd29a5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 14 Dec 2021 11:58:58 +0100 Subject: [PATCH] fix(agnoster): quote % in prompt functions --- themes/agnoster.zsh-theme | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index fe7ddbac6..5f4efe813 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -135,7 +135,7 @@ prompt_git() { zstyle ':vcs_info:*' formats ' %u%c' zstyle ':vcs_info:*' actionformats ' %u%c' vcs_info - echo -n "${ref/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}" + echo -n "${${ref:gs/%/%%}/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}" fi } @@ -153,7 +153,7 @@ prompt_bzr() { if bzr_status=$(bzr status 2>&1); then status_mod=$(echo -n "$bzr_status" | head -n1 | grep "modified" | wc -m) status_all=$(echo -n "$bzr_status" | head -n1 | wc -m) - revision=$(bzr log -r-1 --log-format line | cut -d: -f1) + revision=${$(bzr log -r-1 --log-format line | cut -d: -f1):gs/%/%%} if [[ $status_mod -gt 0 ]] ; then prompt_segment yellow black "bzr@$revision ✚" else @@ -183,7 +183,7 @@ prompt_hg() { # if working copy is clean prompt_segment green $CURRENT_FG fi - echo -n $(hg prompt "☿ {rev}@{branch}") $st + echo -n ${$(hg prompt "☿ {rev}@{branch}"):gs/%/%%} $st else st="" rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g') @@ -197,7 +197,7 @@ prompt_hg() { else prompt_segment green $CURRENT_FG fi - echo -n "☿ $rev@$branch" $st + echo -n "☿ ${rev:gs/%/%%}@${branch:gs/%/%%}" $st fi fi } @@ -209,9 +209,8 @@ prompt_dir() { # Virtualenv: current working virtualenv prompt_virtualenv() { - local virtualenv_path="$VIRTUAL_ENV" - if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then - prompt_segment blue black "(`basename $virtualenv_path`)" + if [[ -n "$VIRTUAL_ENV" && -n "$VIRTUAL_ENV_DISABLE_PROMPT" ]]; then + prompt_segment blue black "(${VIRTUAL_ENV:t:gs/%/%%})" fi } @@ -237,8 +236,8 @@ prompt_status() { prompt_aws() { [[ -z "$AWS_PROFILE" || "$SHOW_AWS_PROMPT" = false ]] && return case "$AWS_PROFILE" in - *-prod|*production*) prompt_segment red yellow "AWS: $AWS_PROFILE" ;; - *) prompt_segment green black "AWS: $AWS_PROFILE" ;; + *-prod|*production*) prompt_segment red yellow "AWS: ${AWS_PROFILE:gs/%/%%}" ;; + *) prompt_segment green black "AWS: ${AWS_PROFILE:gs/%/%%}" ;; esac }