@@ -59,14 +59,14 @@ active_days() {
5959
6060color_for () {
6161 if [ " $to_tty " = true ]; then
62- if [ $1 -gt 200 ]; then color=" $( tputq setaf 1) $( tputq bold) "
63- elif [ $1 -gt 150 ]; then color=" $( tputq setaf 1) " # red
64- elif [ $1 -gt 125 ]; then color=" $( tputq setaf 2) $( tputq bold) "
65- elif [ $1 -gt 100 ]; then color=" $( tputq setaf 2) " # green
66- elif [ $1 -gt 75 ]; then color=" $( tputq setaf 5) $( tputq bold) "
67- elif [ $1 -gt 50 ]; then color=" $( tputq setaf 5) " # purplish
68- elif [ $1 -gt 25 ]; then color=" $( tputq setaf 3) $( tputq bold) "
69- elif [ $1 -gt 10 ]; then color=" $( tputq setaf 3) " # yellow
62+ if [ " $1 " -gt 200 ]; then color=" $( tputq setaf 1) $( tputq bold) "
63+ elif [ " $1 " -gt 150 ]; then color=" $( tputq setaf 1) " # red
64+ elif [ " $1 " -gt 125 ]; then color=" $( tputq setaf 2) $( tputq bold) "
65+ elif [ " $1 " -gt 100 ]; then color=" $( tputq setaf 2) " # green
66+ elif [ " $1 " -gt 75 ]; then color=" $( tputq setaf 5) $( tputq bold) "
67+ elif [ " $1 " -gt 50 ]; then color=" $( tputq setaf 5) " # purplish
68+ elif [ " $1 " -gt 25 ]; then color=" $( tputq setaf 3) $( tputq bold) "
69+ elif [ " $1 " -gt 10 ]; then color=" $( tputq setaf 3) " # yellow
7070 else color=" $( tputq sgr0) " # default color
7171 fi
7272 else
@@ -84,20 +84,21 @@ effort() {
8484 local color reset_color commits len dot f_dot i msg active
8585 reset_color=" "
8686 test " $to_tty " = true && reset_color=" $( tputq sgr0) "
87- commit_dates=$( dates " $path " )
88- [ $? -gt 0 ] && exit 255
87+ if ! commit_dates=$( dates " $path " ) ; then
88+ exit 255
89+ fi
8990
9091 # Ensure it's not just an empty line
91- if [ -z " $( head -c 1 <<< $( echo $ commit_dates) )" ]
92+ if [ -z " $( head -c 1 <<< " $ commit_dates" ) " ]
9293 then
9394 exit 0
9495 fi
9596
96- commits=$( wc -l <<< " $(echo " $ commit_dates" ) " )
97+ commits=$( wc -l <<< " $commit_dates" )
9798 color=' 90'
9899
99100 # ignore <= --above
100- test $commits -le $above && exit 0
101+ test " $commits " -le " $above " && exit 0
101102
102103 # commits
103104 color_for $(( commits - above ))
@@ -109,12 +110,12 @@ effort() {
109110 i=$(( i+ 1 ))
110111 done
111112
112- msg=$( printf " ${color} %s %-10d" " $f_dot " $commits )
113+ msg=$( printf " ${color} %s %-10d" " $f_dot " " $commits " )
113114
114115 # active days
115116 active=$( active_days " $commit_dates " )
116117 color_for $(( active - above ))
117- msg=" $msg $( printf " ${color} %d${reset_color} \n" $active ) "
118+ msg=" $msg $( printf " ${color} %d${reset_color} \n" " $active " ) "
118119 echo " $msg "
119120}
120121
0 commit comments