Refactor code determining prompt colour
This commit is contained in:
parent
816cd8a54b
commit
d629cb14cb
|
@ -32,7 +32,7 @@ function gitstatus()
|
||||||
&& git_local_remote_diffs "$branch" "$remote" \
|
&& git_local_remote_diffs "$branch" "$remote" \
|
||||||
&& local commit_diffs="$REPLY"
|
&& local commit_diffs="$REPLY"
|
||||||
|
|
||||||
git_determine_color ${modified} ${staged} ${deleted} ${untracked}
|
git_determine_color $((modified + staged + deleted + untracked))
|
||||||
local color="${REPLY}"
|
local color="${REPLY}"
|
||||||
|
|
||||||
(( modified > 0 )) \
|
(( modified > 0 )) \
|
||||||
|
@ -168,12 +168,9 @@ function git_local_remote_diffs()
|
||||||
###
|
###
|
||||||
function git_determine_color()
|
function git_determine_color()
|
||||||
{
|
{
|
||||||
for i in "$@"; do
|
if (( $1 > 0 )); then
|
||||||
if (( $i > 0 )); then
|
typeset -g REPLY=$'%F{yellow}'
|
||||||
typeset -g REPLY=$'%F{yellow}'
|
else
|
||||||
return 0
|
typeset -g REPLY=$'%F{green}'
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
typeset -g REPLY=$'%F{green}'
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue