mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Added my own theme, with Mercurial repo status.
This commit is contained in:
parent
01b0366f3e
commit
4c58314c4b
2 changed files with 85 additions and 0 deletions
32
lib/hg.zsh
Normal file
32
lib/hg.zsh
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# get the name of the branch we are on
|
||||
function hg_prompt_info() {
|
||||
ref=$(hg branch 2> /dev/null) || return
|
||||
echo "$ZSH_THEME_HG_PROMPT_PREFIX${ref}$(hg_prompt_status)$ZSH_THEME_HG_PROMPT_SUFFIX"
|
||||
}
|
||||
|
||||
parse_hg_dirty () {
|
||||
if [[ -n $(hg status 2> /dev/null) ]]; then
|
||||
echo "$ZSH_THEME_HG_PROMPT_DIRTY"
|
||||
else
|
||||
echo "$ZSH_THEME_HG_PROMPT_CLEAN"
|
||||
fi
|
||||
}
|
||||
|
||||
# get the status of the working tree
|
||||
hg_prompt_status() {
|
||||
INDEX=$(hg status 2> /dev/null)
|
||||
STATUS=""
|
||||
if $(echo "$INDEX" | grep '^? ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_HG_PROMPT_UNTRACKED$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^A ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_HG_PROMPT_ADDED$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^M ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_HG_PROMPT_MODIFIED$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^R ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_HG_PROMPT_DELETED$STATUS"
|
||||
fi
|
||||
echo $STATUS
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue