summaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
authorMarc Cornellà <hello@mcornella.com>2022-01-03 17:05:48 +0100
committerMarc Cornellà <hello@mcornella.com>2022-01-03 17:05:48 +0100
commit8e973d42bd3bc5028d88ce731113b03ac8a5590c (patch)
tree44758d6a8221100107dea544560124c33c652296 /themes
parentd87ab251c7fe18626b2d0c4e4a184e7bed7c508b (diff)
downloadzsh-8e973d42bd3bc5028d88ce731113b03ac8a5590c.tar.gz
zsh-8e973d42bd3bc5028d88ce731113b03ac8a5590c.tar.bz2
zsh-8e973d42bd3bc5028d88ce731113b03ac8a5590c.zip
fix(bureau): fix `status` variable name causing error (#10561)
Also cleaned up the code a bit Fixes #10561
Diffstat (limited to 'themes')
-rw-r--r--themes/bureau.zsh-theme53
1 files changed, 26 insertions, 27 deletions
diff --git a/themes/bureau.zsh-theme b/themes/bureau.zsh-theme
index 7a253a688..50058e213 100644
--- a/themes/bureau.zsh-theme
+++ b/themes/bureau.zsh-theme
@@ -24,59 +24,58 @@ bureau_git_branch () {
}
bureau_git_status() {
- local _STATUS _INDEX
+ local result gitstatus
# check status of files
- _INDEX=$(command git status --porcelain 2> /dev/null)
- if [[ -n "$_INDEX" ]]; then
- if $(echo "$_INDEX" | command grep -q '^[AMRD]. '); then
- _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED"
+ gitstatus=$(command git status --porcelain -b 2> /dev/null)
+ if [[ -n "$gitstatus" ]]; then
+ if $(echo "$gitstatus" | command grep -q '^[AMRD]. '); then
+ result+="$ZSH_THEME_GIT_PROMPT_STAGED"
fi
- if $(echo "$_INDEX" | command grep -q '^.[MTD] '); then
- _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED"
+ if $(echo "$gitstatus" | command grep -q '^.[MTD] '); then
+ result+="$ZSH_THEME_GIT_PROMPT_UNSTAGED"
fi
- if $(echo "$_INDEX" | command grep -q -E '^\?\? '); then
- _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED"
+ if $(echo "$gitstatus" | command grep -q -E '^\?\? '); then
+ result+="$ZSH_THEME_GIT_PROMPT_UNTRACKED"
fi
- if $(echo "$_INDEX" | command grep -q '^UU '); then
- _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED"
+ if $(echo "$gitstatus" | command grep -q '^UU '); then
+ result+="$ZSH_THEME_GIT_PROMPT_UNMERGED"
fi
else
- _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_CLEAN"
+ result+="$ZSH_THEME_GIT_PROMPT_CLEAN"
fi
# check status of local repository
- _INDEX=$(command git status --porcelain -b 2> /dev/null)
- if $(echo "$_INDEX" | command grep -q '^## .*ahead'); then
- _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD"
+ if $(echo "$gitstatus" | command grep -q '^## .*ahead'); then
+ result+="$ZSH_THEME_GIT_PROMPT_AHEAD"
fi
- if $(echo "$_INDEX" | command grep -q '^## .*behind'); then
- _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND"
+ if $(echo "$gitstatus" | command grep -q '^## .*behind'); then
+ result+="$ZSH_THEME_GIT_PROMPT_BEHIND"
fi
- if $(echo "$_INDEX" | command grep -q '^## .*diverged'); then
- _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED"
+ if $(echo "$gitstatus" | command grep -q '^## .*diverged'); then
+ result+="$ZSH_THEME_GIT_PROMPT_DIVERGED"
fi
if $(command git rev-parse --verify refs/stash &> /dev/null); then
- _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED"
+ result+="$ZSH_THEME_GIT_PROMPT_STASHED"
fi
- echo $_STATUS
+ echo $result
}
bureau_git_prompt() {
- local branch=$(bureau_git_branch)
- local status=$(bureau_git_status)
+ local gitbranch=$(bureau_git_branch)
+ local gitstatus=$(bureau_git_status)
local info
- if [[ -z "${branch}" ]]; then
+ if [[ -z "$gitbranch" ]]; then
return
fi
- info="${branch:gs/%/%%}"
+ info="${gitbranch:gs/%/%%}"
- if [[ -n "${status}" ]]; then
- info+=" $status"
+ if [[ -n "$gitstatus" ]]; then
+ info+=" $gitstatus"
fi
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${info}${ZSH_THEME_GIT_PROMPT_SUFFIX}"