Use less wc calls
Use grep -c to avoid a call to wc
This commit is contained in:
parent
1808f69405
commit
549f820e9d
12
liquidprompt
12
liquidprompt
@ -829,7 +829,7 @@ _lp_hg_branch_color()
|
|||||||
if [[ -n "$branch" ]] ; then
|
if [[ -n "$branch" ]] ; then
|
||||||
|
|
||||||
local has_untracked
|
local has_untracked
|
||||||
has_untracked=$(hg status 2>/dev/null | grep '\(^\?\)' | wc -l)
|
has_untracked=$(hg status 2>/dev/null | grep -c '\(^\?\)')
|
||||||
if [[ -z "$has_untracked" ]] ; then
|
if [[ -z "$has_untracked" ]] ; then
|
||||||
has_untracked=""
|
has_untracked=""
|
||||||
else
|
else
|
||||||
@ -837,7 +837,7 @@ _lp_hg_branch_color()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local has_commit
|
local has_commit
|
||||||
has_commit=$(hg outgoing --no-merges ${branch} 2>/dev/null | grep '\(^changeset\:\)' | wc -l)
|
has_commit=$(hg outgoing --no-merges ${branch} 2>/dev/null | grep -c '\(^changeset\:\)')
|
||||||
if [[ -z "$has_commit" ]] ; then
|
if [[ -z "$has_commit" ]] ; then
|
||||||
has_commit=0
|
has_commit=0
|
||||||
fi
|
fi
|
||||||
@ -951,11 +951,11 @@ _lp_fossil_branch_color()
|
|||||||
local ret
|
local ret
|
||||||
C2E=$(fossil changes | wc -l)
|
C2E=$(fossil changes | wc -l)
|
||||||
C2A=$(fossil extras | wc -l)
|
C2A=$(fossil extras | wc -l)
|
||||||
PLUSLINE=$(fossil diff | egrep '^\+[^+].+$' | wc -l)
|
PLUSLINE=$(fossil diff | egrep -c '^\+[^+].+$')
|
||||||
MINUSLINE=$(fossil diff | egrep '^-[^-].+$' | wc -l)
|
MINUSLINE=$(fossil diff | egrep -c '^-[^-].+$')
|
||||||
ret=""
|
ret=""
|
||||||
|
|
||||||
C2AA=`fossil changes | grep ADDED | wc -l`
|
C2AA=`fossil changes | grep -c "ADDED"`
|
||||||
if [[ $C2AA -gt 0 ]] ; then
|
if [[ $C2AA -gt 0 ]] ; then
|
||||||
# We count the line "à la" git
|
# We count the line "à la" git
|
||||||
local ADDFILE
|
local ADDFILE
|
||||||
@ -971,7 +971,7 @@ _lp_fossil_branch_color()
|
|||||||
ret+="+$PLUSLINE"
|
ret+="+$PLUSLINE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
C2D=`fossil changes | grep DELETED | wc -l`
|
C2D=`fossil changes | grep -c "DELETED"`
|
||||||
if [[ $C2D -gt 0 ]] ; then
|
if [[ $C2D -gt 0 ]] ; then
|
||||||
# We count the line "à la" git
|
# We count the line "à la" git
|
||||||
local DELFILE
|
local DELFILE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user