21 lines
486 B
Plaintext
21 lines
486 B
Plaintext
|
CSTATUS=""
|
||
|
update_cstatus() {
|
||
|
git_stat=`cd /opt/tools/server-config/; git diff --shortstat | tr -c -d '[0-9,]'`
|
||
|
if [[ "$git_stat" = "" ]]; then
|
||
|
CSTATUS=""
|
||
|
else
|
||
|
stats=(${(@s:,:)git_stat})
|
||
|
CSTATUS="[%F{green}+${stats[2]}%f/%F{red}-${stats[3]}%f]"
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
autoload -U add-zsh-hook
|
||
|
add-zsh-hook preexec update_cstatus
|
||
|
add-zsh-hook precmd update_cstatus
|
||
|
|
||
|
setopt PROMPT_SUBST
|
||
|
PS1='%T $CSTATUS %(?.%F{green}√.%F{red}?%?)%f %F{#666}%~%f %# '
|
||
|
|
||
|
alias c="/opt/tools/server-config/c.sh"
|
||
|
|