Update 30.01.2022

This commit is contained in:
2022-01-30 00:39:21 +05:00
parent 3d6a64111c
commit 04423b8c5c
323 changed files with 44877 additions and 7114 deletions

View File

@@ -17,64 +17,68 @@ ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg_bold[yellow]%}●%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[red]%}●%{$reset_color%}"
bureau_git_branch () {
local ref
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
echo "${ref#refs/heads/}"
}
bureau_git_status() {
_STATUS=""
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 _result=""
if [[ "${_branch}x" != "x" ]]; then
_result="$ZSH_THEME_GIT_PROMPT_PREFIX$_branch"
if [[ "${_status}x" != "x" ]]; then
_result="$_result $_status"
fi
_result="$_result$ZSH_THEME_GIT_PROMPT_SUFFIX"
bureau_git_prompt() {
local gitbranch=$(bureau_git_branch)
local gitstatus=$(bureau_git_status)
local info
if [[ -z "$gitbranch" ]]; then
return
fi
echo $_result
info="${gitbranch:gs/%/%%}"
if [[ -n "$gitstatus" ]]; then
info+=" $gitstatus"
fi
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${info}${ZSH_THEME_GIT_PROMPT_SUFFIX}"
}