summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues.hiegel@qosmos.com>2012-01-13 12:40:06 +0100
committerHugues Hiegel <hugues.hiegel@qosmos.com>2012-01-13 12:40:06 +0100
commitc70289d898e7aba51d6dbddc1816bf833b1e3d95 (patch)
treeb037fccceef7eb7bb3317bdb00db3b50ca83cb4a
parent9559df1ccf7733a378595193064d0ab763e72cbd (diff)
[Prompts] guilt
-rw-r--r--01_Functions.zsh34
-rw-r--r--11_Colors.zsh2
-rw-r--r--12_Prompts.zsh2
3 files changed, 36 insertions, 2 deletions
diff --git a/01_Functions.zsh b/01_Functions.zsh
index 6a10c86..1dec1c0 100644
--- a/01_Functions.zsh
+++ b/01_Functions.zsh
@@ -218,6 +218,37 @@ get_git_branch ()
echo $my_git_branch
}
+get_guilt_series ()
+{
+ # Guilt
+ #
+ guilt=""
+
+ if cmd_exists guilt
+ then
+ applied=$(guilt applied 2>/dev/null | wc -l)
+ unapplied=$(guilt unapplied 2>/dev/null | wc -l)
+ if [ $(($applied + $unapplied)) -gt 0 ]
+ then
+ guilt=" "$C_$guilt_colors[applied]$_C
+ while [ $applied -gt 0 ]
+ do
+ guilt=$guilt"+"
+ applied=$(($applied - 1))
+ done
+ guilt=$guilt$C_$guilt_colors[unapplied]$_C
+ while [ $unapplied -gt 0 ]
+ do
+ guilt=$guilt"-"
+ unapplied=$(($unapplied - 1))
+ done
+ guilt=$guilt$C_$colors[none]$_C
+ fi
+ fi
+
+ echo $guilt
+}
+
# We *must* have previously checked that
# we obtained a correct GIT branch with
# a call to `get_git_branch`
@@ -362,6 +393,9 @@ set_prompt_colors ()
git_colors[not_up_to_date]="$prompt_colors[not_up_to_date];$color[normal]" # git changes in working tree
git_colors[init_in_progress]="$color[black];$color[bold]" # initialization
git_colors[up_to_date]="$prompt_colors[up_to_date]" # git up-to-date
+
+ guilt_colors[applied]=$git_colors[cached]
+ guilt_colors[unapplied]=$color[black]
}
birthdays()
diff --git a/11_Colors.zsh b/11_Colors.zsh
index 63c20e2..e194665 100644
--- a/11_Colors.zsh
+++ b/11_Colors.zsh
@@ -7,7 +7,7 @@
## You are encouraged to use, modify, and redistribute
## these files with or without this notice.
##
-typeset -A prompt_colors git_colors mail_colors correct_colors battery_colors date_colors agent_colors
+typeset -A prompt_colors git_colors mail_colors correct_colors battery_colors date_colors agent_colors guilt_colors
correct_colors[error]="$color[red];$color[bold]"
correct_colors[suggest]="$color[blue];$color[bold]"
diff --git a/12_Prompts.zsh b/12_Prompts.zsh
index e37ac86..a9c02fd 100644
--- a/12_Prompts.zsh
+++ b/12_Prompts.zsh
@@ -298,7 +298,7 @@ update_prompt_elements()
# then we reduce the path until it reaches the last path element,
spaceleft=$(($spaceleft - $GITBRANCHSIZE))
[ $spaceleft -lt $minimalpathsize ] && spaceleft=$minimalpathsize
- GITBRANCH=${GITBRANCH:+ $C_"$(get_git_status)"$_C$GITBRANCH}
+ GITBRANCH=${GITBRANCH:+ $C_"$(get_git_status)"$_C$GITBRANCH}"$(get_guilt_series)"
CURDIR="$C_$prompt_colors[path]$_C%`echo $spaceleft`<..<"$MY_PATH"%<<$C_$color[none]$_C"
[ "$DEBUG" = "yes" ] && echo
}