1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-17 11:20:09 +00:00

fix(agnoster): quote % in prompt functions

This commit is contained in:
Marc Cornellà 2021-12-14 11:58:58 +01:00
parent 3e9fe6e772
commit 9836aebe67
No known key found for this signature in database
GPG key ID: 0314585E776A9C1B

View file

@ -135,7 +135,7 @@ prompt_git() {
zstyle ':vcs_info:*' formats ' %u%c' zstyle ':vcs_info:*' formats ' %u%c'
zstyle ':vcs_info:*' actionformats ' %u%c' zstyle ':vcs_info:*' actionformats ' %u%c'
vcs_info 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 fi
} }
@ -153,7 +153,7 @@ prompt_bzr() {
if bzr_status=$(bzr status 2>&1); then if bzr_status=$(bzr status 2>&1); then
status_mod=$(echo -n "$bzr_status" | head -n1 | grep "modified" | wc -m) status_mod=$(echo -n "$bzr_status" | head -n1 | grep "modified" | wc -m)
status_all=$(echo -n "$bzr_status" | head -n1 | 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 if [[ $status_mod -gt 0 ]] ; then
prompt_segment yellow black "bzr@$revision ✚" prompt_segment yellow black "bzr@$revision ✚"
else else
@ -183,7 +183,7 @@ prompt_hg() {
# if working copy is clean # if working copy is clean
prompt_segment green $CURRENT_FG prompt_segment green $CURRENT_FG
fi fi
echo -n $(hg prompt "☿ {rev}@{branch}") $st echo -n ${$(hg prompt "☿ {rev}@{branch}"):gs/%/%%} $st
else else
st="" st=""
rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g') rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
@ -197,7 +197,7 @@ prompt_hg() {
else else
prompt_segment green $CURRENT_FG prompt_segment green $CURRENT_FG
fi fi
echo -n "☿ $rev@$branch" $st echo -n "☿ ${rev:gs/%/%%}@${branch:gs/%/%%}" $st
fi fi
fi fi
} }
@ -209,9 +209,8 @@ prompt_dir() {
# Virtualenv: current working virtualenv # Virtualenv: current working virtualenv
prompt_virtualenv() { prompt_virtualenv() {
local virtualenv_path="$VIRTUAL_ENV" if [[ -n "$VIRTUAL_ENV" && -n "$VIRTUAL_ENV_DISABLE_PROMPT" ]]; then
if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then prompt_segment blue black "(${VIRTUAL_ENV:t:gs/%/%%})"
prompt_segment blue black "(`basename $virtualenv_path`)"
fi fi
} }
@ -237,8 +236,8 @@ prompt_status() {
prompt_aws() { prompt_aws() {
[[ -z "$AWS_PROFILE" || "$SHOW_AWS_PROMPT" = false ]] && return [[ -z "$AWS_PROFILE" || "$SHOW_AWS_PROMPT" = false ]] && return
case "$AWS_PROFILE" in case "$AWS_PROFILE" in
*-prod|*production*) prompt_segment red yellow "AWS: $AWS_PROFILE" ;; *-prod|*production*) prompt_segment red yellow "AWS: ${AWS_PROFILE:gs/%/%%}" ;;
*) prompt_segment green black "AWS: $AWS_PROFILE" ;; *) prompt_segment green black "AWS: ${AWS_PROFILE:gs/%/%%}" ;;
esac esac
} }