From 316bbb96be20f1e22aceefaac1f5818fc2f98f0a Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 24 Jun 2010 11:32:46 +0200 Subject: [Funcs] zsh current git status watchdog --- 01_Functions.zsh | 6 ++++++ 12_Prompts.zsh | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/01_Functions.zsh b/01_Functions.zsh index 33a0b4e..90764fb 100644 --- a/01_Functions.zsh +++ b/01_Functions.zsh @@ -214,6 +214,12 @@ get_git_status () echo $my_git_status } +zsh_status () +{ + cd ~/.zsh + echo "$(git describe --dirty="$(git diff | md5sum | sed 's/^\(.......\).*$/-D1rTY-\1/')" --always)" +} + normal_user () { if [ -e /etc/login.defs ] diff --git a/12_Prompts.zsh b/12_Prompts.zsh index 21779a0..972e140 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -323,8 +323,31 @@ redefine_prompt () } +ZSH_STATUS=$(zsh_status) +if ( echo $ZSH_STATUS | grep -q -- "-D1rTY-" ) +then + echo -n $c_$prompt_colors[error]$_c + toilet -f bigmono9 "D1rTY Zsh.." + echo -n " You should cleanup your working copy of ~/.zsh .." + echo $c_$prompt_colors[none]$_c + echo +fi + 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-" ) + then + echo -n "Zsh Up-To-Date but still WIP.." + else + echo -n "You should restart Zsh.." + fi + echo $c_$prompt_colors[none]$_c + fi + update_prompt_elements redefine_prompt } -- cgit v1.2.3