agnoster-theme-baz-plugin/plugin/functions/prompt_git
Ari Archer ef9160c4a6
init
Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
2022-06-18 23:04:43 +03:00

15 lines
550 B
Bash

local ref dirty
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
ZSH_THEME_GIT_PROMPT_DIRTY='±'
dirty=$(git_status_dirty)
stash=$(git_stash_dirty)
ref=$(git symbolic-ref HEAD 2> /dev/null) \
|| ref="$(git describe --exact-match --tags HEAD 2> /dev/null)" \
|| ref="$(git show-ref --head -s --abbrev | head -n1 2> /dev/null)"
if [[ -n $dirty ]]; then
prompt_segment yellow black
else
prompt_segment green black
fi
PR="$PR${ref/refs\/heads\// }$stash$dirty"
fi