aboutsummaryrefslogtreecommitdiffhomepage
path: root/share
diff options
context:
space:
mode:
authorGravatar Mariusz Smykuła <mariuszs@gmail.com>2013-06-17 19:29:34 +0200
committerGravatar Mariusz Smykuła <mariuszs@gmail.com>2013-06-17 19:29:34 +0200
commit1debe4f055cd4d6c61b6a21a080cd33234b22fc3 (patch)
tree646cfeb52a53b38e094e2ac8f31afd2d03b09b3b /share
parent9b9ce3155088f105b98ee77d3ff3897407044559 (diff)
Informative version of __fish_git_prompt_show_upstream
Diffstat (limited to 'share')
-rw-r--r--share/functions/__fish_git_prompt.fish67
1 files changed, 43 insertions, 24 deletions
diff --git a/share/functions/__fish_git_prompt.fish b/share/functions/__fish_git_prompt.fish
index 407edc48..c6bd511f 100644
--- a/share/functions/__fish_git_prompt.fish
+++ b/share/functions/__fish_git_prompt.fish
@@ -82,6 +82,7 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi
set -l upstream git
set -l legacy
set -l verbose
+ set -l informative
set -l svn_url_pattern
set -l show_upstream $__fish_git_prompt_showupstream
git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showUpstream)$' ^/dev/null | tr '\0\n' '\n ' | while read -l key value
@@ -109,6 +110,8 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi
set upstream $option
case verbose
set verbose 1
+ case informative
+ set informative 1
case legacy
set legacy 1
end
@@ -176,31 +179,44 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi
end
# calculate the result
- if test -z "$verbose"
- switch "$count"
- case '' # no upstream
- case "0 0" # equal to upstream
- echo $___fish_git_prompt_char_upstream_equal
- case "0 *" # ahead of upstream
- echo $___fish_git_prompt_char_upstream_ahead
- case "* 0" # behind upstream
- echo $___fish_git_prompt_char_upstream_behind
- case '*' # diverged from upstream
- echo $___fish_git_prompt_char_upstream_diverged
- end
+ if test -n "$verbose"
+ echo $count | read -l behind ahead
+ switch "$count"
+ case '' # no upstream
+ case "0 0" # equal to upstream
+ echo "$___fish_git_prompt_char_upstream_prefix$___fish_git_prompt_char_upstream_equal"
+ case "0 *" # ahead of upstream
+ echo "$___fish_git_prompt_char_upstream_prefix$___fish_git_prompt_char_upstream_ahead$ahead"
+ case "* 0" # behind upstream
+ echo "$___fish_git_prompt_char_upstream_prefix$___fish_git_prompt_char_upstream_behind$behind"
+ case '*' # diverged from upstream
+ echo "$___fish_git_prompt_char_upstream_prefix$___fish_git_prompt_char_upstream_diverged$ahead-$behind"
+ end
+ else if test -n informative
+ echo $count | read -l behind ahead
+ switch "$count"
+ case '' # no upstream
+ case "0 0" # equal to upstream
+ echo "$___fish_git_prompt_char_upstream_prefix$___fish_git_prompt_char_upstream_equal"
+ case "0 *" # ahead of upstream
+ echo "$___fish_git_prompt_char_upstream_prefix$___fish_git_prompt_char_upstream_ahead$ahead"
+ case "* 0" # behind upstream
+ echo "$___fish_git_prompt_char_upstream_prefix$___fish_git_prompt_char_upstream_behind$behind"
+ case '*' # diverged from upstream
+ echo "$___fish_git_prompt_char_upstream_prefix$___fish_git_prompt_char_upstream_ahead$ahead$___fish_git_prompt_char_upstream_behind$behind"
+ end
else
- echo $count | read -l behind ahead
- switch "$count"
- case '' # no upstream
- case "0 0" # equal to upstream
- echo " $___fish_git_prompt_char_upstream_equal"
- case "0 *" # ahead of upstream
- echo " $___fish_git_prompt_char_upstream_ahead$ahead"
- case "* 0" # behind upstream
- echo " $___fish_git_prompt_char_upstream_behind$behind"
- case '*' # diverged from upstream
- echo " $___fish_git_prompt_char_upstream_diverged$ahead-$behind"
- end
+ switch "$count"
+ case '' # no upstream
+ case "0 0" # equal to upstream
+ echo "$___fish_git_prompt_char_upstream_prefix$___fish_git_prompt_char_upstream_equal"
+ case "0 *" # ahead of upstream
+ echo "$___fish_git_prompt_char_upstream_prefix$___fish_git_prompt_char_upstream_ahead$ahead"
+ case "* 0" # behind upstream
+ echo "$___fish_git_prompt_char_upstream_prefix$___fish_git_prompt_char_upstream_behind$behind"
+ case '*' # diverged from upstream
+ echo "$___fish_git_prompt_char_upstream_prefix$___fish_git_prompt_char_upstream_diverged$ahead-$behind"
+ end
end
end
@@ -416,6 +432,9 @@ function __fish_git_prompt_validate_chars --description "__fish_git_prompt helpe
if not set -q ___fish_git_prompt_char_upstream_diverged
set -g ___fish_git_prompt_char_upstream_diverged (set -q __fish_git_prompt_char_upstream_diverged; and echo $__fish_git_prompt_char_upstream_diverged; or echo '<>')
end
+ if not set -q ___fish_git_prompt_char_upstream_prefix
+ set -g ___fish_git_prompt_char_upstream_prefix (set -q __fish_git_prompt_char_upstream_prefix; and echo $__fish_git_prompt_char_upstream_prefix; or echo ' ')
+ end
end
function __fish_git_prompt_validate_colors --description "__fish_git_prompt helper, checks color variables"