Added mercurial library

The added library parses output of the hg (mercurial) command, and outputs
the same variables (which should be customized by theme) in your prompt.
I added an example of these variables to michelebologna theme.

This patch should uniform all the behaviour of all themes regarding mercurial.
In fact, some themes implement their own hg parsing *inside* the theme.
This should be better implemented in a library, as happens with git library.
This commit is contained in:
Michele Bologna 2015-09-22 16:36:31 +02:00
commit 194c5b1ca3
3 changed files with 39 additions and 1 deletions

View file

@ -68,8 +68,14 @@ ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE=">"
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="<"
ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="$red<>"
ZSH_THEME_HG_PROMPT_MODIFIED="$red*"
ZSH_THEME_HG_PROMPT_ADDED="$green+"
ZSH_THEME_HG_PROMPT_UNTRACKED="$blue%%"
PROMPT='$username_output$hostname_output:$current_dir_output%1(j. [$jobs_bg].)'
GIT_PROMPT='$(out=$(git_prompt_info)$(git_prompt_status)$(git_remote_status);if [[ -n $out ]]; then printf %s " $white($green$out$white)$reset";fi)'
PROMPT+="$GIT_PROMPT"
HG_PROMPT='$(out=$(hg_prompt_info);if [[ -n $out ]]; then printf %s " $white($green$out$white)$reset";fi)'
PROMPT+="$HG_PROMPT"
PROMPT+=" $last_command_output%#$reset "
RPROMPT=''