mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-14 01:40:09 +00:00
parent
2d3bae965a
commit
9e9831fcf2
1 changed files with 11 additions and 9 deletions
|
@ -25,20 +25,21 @@ bureau_git_branch () {
|
||||||
|
|
||||||
bureau_git_status() {
|
bureau_git_status() {
|
||||||
local result gitstatus
|
local result gitstatus
|
||||||
|
gitstatus="$(command git status --porcelain -b 2>/dev/null)"
|
||||||
|
|
||||||
# check status of files
|
# check status of files
|
||||||
gitstatus=$(command git status --porcelain -b 2> /dev/null)
|
local gitfiles="$(tail -n +2 <<< "$gitstatus")"
|
||||||
if [[ -n "$gitstatus" ]]; then
|
if [[ -n "$gitfiles" ]]; then
|
||||||
if $(echo "$gitstatus" | command grep -q '^[AMRD]. '); then
|
if $(echo "$gitfiles" | command grep -q '^[AMRD]. '); then
|
||||||
result+="$ZSH_THEME_GIT_PROMPT_STAGED"
|
result+="$ZSH_THEME_GIT_PROMPT_STAGED"
|
||||||
fi
|
fi
|
||||||
if $(echo "$gitstatus" | command grep -q '^.[MTD] '); then
|
if $(echo "$gitfiles" | command grep -q '^.[MTD] '); then
|
||||||
result+="$ZSH_THEME_GIT_PROMPT_UNSTAGED"
|
result+="$ZSH_THEME_GIT_PROMPT_UNSTAGED"
|
||||||
fi
|
fi
|
||||||
if $(echo "$gitstatus" | command grep -q -E '^\?\? '); then
|
if $(echo "$gitfiles" | command grep -q -E '^\?\? '); then
|
||||||
result+="$ZSH_THEME_GIT_PROMPT_UNTRACKED"
|
result+="$ZSH_THEME_GIT_PROMPT_UNTRACKED"
|
||||||
fi
|
fi
|
||||||
if $(echo "$gitstatus" | command grep -q '^UU '); then
|
if $(echo "$gitfiles" | command grep -q '^UU '); then
|
||||||
result+="$ZSH_THEME_GIT_PROMPT_UNMERGED"
|
result+="$ZSH_THEME_GIT_PROMPT_UNMERGED"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -46,13 +47,14 @@ bureau_git_status() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check status of local repository
|
# check status of local repository
|
||||||
if $(echo "$gitstatus" | command grep -q '^## .*ahead'); then
|
local gitbranch="$(head -n 1 <<< "$gitstatus")"
|
||||||
|
if $(echo "$gitbranch" | command grep -q '^## .*ahead'); then
|
||||||
result+="$ZSH_THEME_GIT_PROMPT_AHEAD"
|
result+="$ZSH_THEME_GIT_PROMPT_AHEAD"
|
||||||
fi
|
fi
|
||||||
if $(echo "$gitstatus" | command grep -q '^## .*behind'); then
|
if $(echo "$gitbranch" | command grep -q '^## .*behind'); then
|
||||||
result+="$ZSH_THEME_GIT_PROMPT_BEHIND"
|
result+="$ZSH_THEME_GIT_PROMPT_BEHIND"
|
||||||
fi
|
fi
|
||||||
if $(echo "$gitstatus" | command grep -q '^## .*diverged'); then
|
if $(echo "$gitbranch" | command grep -q '^## .*diverged'); then
|
||||||
result+="$ZSH_THEME_GIT_PROMPT_DIVERGED"
|
result+="$ZSH_THEME_GIT_PROMPT_DIVERGED"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue