Extract hg_status variable

This commit is contained in:
Michele Bologna 2016-08-18 18:39:47 +02:00
parent 194c5b1ca3
commit 3ff5de73e2

View File

@ -17,15 +17,19 @@ hg_prompt_info()
local STATUS="" local STATUS=""
if $(hg id >/dev/null 2>&1); then if $(hg id >/dev/null 2>&1); then
local BRANCH=$(hg branch 2>/dev/null) local BRANCH=$(hg branch 2>/dev/null)
if `hg status | grep -q "^\?"`; then local STATUS_OUTPUT=$(hg status)
if echo $STATUS_OUTPUT | grep -q "^\?"; then
STATUS="$ZSH_THEME_HG_PROMPT_UNTRACKED" STATUS="$ZSH_THEME_HG_PROMPT_UNTRACKED"
fi fi
if `hg status | grep -q "^[A]"`; then if echo $STATUS_OUTPUT | grep -q "^[A]"; then
STATUS="$ZSH_THEME_HG_PROMPT_ADDED$STATUS" STATUS="$ZSH_THEME_HG_PROMPT_ADDED$STATUS"
fi fi
if `hg status | grep -q "^[M]"`; then if echo $STATUS_OUTPUT | grep -q "^[M]"; then
STATUS="$ZSH_THEME_HG_PROMPT_MODIFIED$STATUS" STATUS="$ZSH_THEME_HG_PROMPT_MODIFIED$STATUS"
fi fi
if [ ! "$STATUS" = "" ] ; then
STATUS=" $STATUS"
fi
echo "$BRANCH$STATUS" echo "$BRANCH$STATUS"
fi fi
} }