summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2010-06-24 11:52:25 +0200
committerHugues Hiegel <hugues@hiegel.fr>2010-06-24 11:52:25 +0200
commit51615ec88e7a9e8d878c783d78d81d28a84babc7 (patch)
tree3380259a32bf923fbe15b93aebd3a7a98d69243b
parent316bbb96be20f1e22aceefaac1f5818fc2f98f0a (diff)
[Funcs] zsh-status watchdog update
-rw-r--r--01_Functions.zsh6
-rw-r--r--12_Prompts.zsh18
2 files changed, 15 insertions, 9 deletions
diff --git a/01_Functions.zsh b/01_Functions.zsh
index 90764fb..8cb2f24 100644
--- a/01_Functions.zsh
+++ b/01_Functions.zsh
@@ -216,8 +216,8 @@ get_git_status ()
zsh_status ()
{
- cd ~/.zsh
- echo "$(git describe --dirty="$(git diff | md5sum | sed 's/^\(.......\).*$/-D1rTY-\1/')" --always)"
+ cd ~/.zsh >/dev/null
+ echo "$(git describe --dirty="$((git cdiff ; git diff) | md5sum | sed 's/^\(.......\).*$/-D1rTY-\1/')" --always)"
}
normal_user ()
@@ -265,6 +265,8 @@ set_prompt_colors ()
prompt_colors[braces]="$prompt_colors[bar]" # braces (around date) - bar color
prompt_colors[error]="$color[bold];$color[yellow]" # error code - bold yellow
+ prompt_colors[warning]="$color[bold];$color[black]"
+
date_colors[normal]=$prompt_colors[soft_generic]
date_colors[exec]=$prompt_colors[bold_generic]
prompt_colors[date]=$date_colors[normal] # full date
diff --git a/12_Prompts.zsh b/12_Prompts.zsh
index 972e140..3639bb6 100644
--- a/12_Prompts.zsh
+++ b/12_Prompts.zsh
@@ -326,9 +326,8 @@ redefine_prompt ()
ZSH_STATUS=$(zsh_status)
if ( echo $ZSH_STATUS | grep -q -- "-D1rTY-" )
then
- echo -n $c_$prompt_colors[error]$_c
+ echo -n $c_$prompt_colors[warning]$_c
toilet -f bigmono9 "D1rTY Zsh.."
- echo -n " You should cleanup your working copy of ~/.zsh .."
echo $c_$prompt_colors[none]$_c
echo
fi
@@ -338,14 +337,19 @@ precmd()
NEW_STATUS=$(zsh_status)
if [ $NEW_STATUS != $ZSH_STATUS ]
then
- echo -n $c_$prompt_colors[error]$_c
- if ( echo $NEW_STATUS | grep -q -- "-D1rTY-" )
+ if ! ( echo $NEW_STATUS | grep -q -- "-D1rTY-" )
then
- echo -n "Zsh Up-To-Date but still WIP.."
- else
+ echo -n $c_$prompt_colors[warning]$_c
echo -n "You should restart Zsh.."
+ echo $c_$prompt_colors[none]$_c
+ fi
+ else
+ if ( echo $ZSH_STATUS | grep -q -- "-D1rTY-" )
+ then
+ echo -n $c_$prompt_colors[warning]$_c
+ echo -n "Your Zsh working copy is not clean.."
+ echo $c_$prompt_colors[none]$_c
fi
- echo $c_$prompt_colors[none]$_c
fi
update_prompt_elements