3 #=======================================================================
9 # Author: Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later.
11 #=======================================================================
27 " -n "$progname" -- "$@
")"
28 test "$?" = "0" ||
exit 1
37 -c|
--colour) opt_colour
=1; shift ;;
38 -h|
--help) opt_help
=1; shift ;;
39 -q|
--quiet) opt_quiet
=$
(($opt_quiet + 1)); shift ;;
40 -v|
--verbose) opt_verbose
=$
(($opt_verbose + 1)); shift ;;
41 --version) echo $progname $VERSION; exit 0 ;;
43 *) echo $progname: Internal error
>&2; exit 1 ;;
46 opt_verbose
=$
(($opt_verbose - $opt_quiet))
48 if test "$opt_help" = "1"; then
49 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
52 Usage: $progname [options] FILE [FILES [...]]
57 Use colour in output; red if behind schedule, green if ahead.
61 Be more quiet. Can be repeated to increase silence.
63 Increase level of verbosity. Can be repeated.
65 Print version information.
73 begintime
="$(date -u +"%Y-
%m-
%d
%H
:%M
:%S
")"
74 beginvalue
=$
(bin
/stats
--data $files |
wc -w)
76 colour_str
="$(test "$opt_colour" = "1" && echo " --colour")"
80 stats_outp="$
(bin
/stats
$colour_str $files)"
82 currgoal=$(echo "$stats_outp" | grep ^Goal | awk '{ print $2 }')
83 currtime="$
(TZ
=UTC stat
$files -c %y |
head -c 19)"
85 goal -c "$currtime" "$begintime" $beginvalue $currgoal $(
86 bin/stats --data $files | wc -w