2021-07-13 21:12:26 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2022-01-15 05:33:32 +00:00
|
|
|
# make a timesheet from a month's data from the Zeit db
|
2024-09-26 04:15:43 +00:00
|
|
|
|
2022-01-15 05:33:32 +00:00
|
|
|
|
2021-07-13 21:12:26 +00:00
|
|
|
if [ -z $2 ]; then
|
|
|
|
echo "usage:"
|
|
|
|
echo " $0 MONTH YEAR"
|
|
|
|
echo " Print report of tracked time for the given month to stdout"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
month=$1
|
|
|
|
year=$2
|
|
|
|
|
|
|
|
start=$(date -Is --date="0:00 ${month} 1 ${year}")
|
|
|
|
|
|
|
|
case ${month} in
|
|
|
|
jan|Jan|january|January) nextMonth=feb;;
|
|
|
|
feb|Feb|february|February) nextMonth=mar;;
|
|
|
|
mar|Mar|march|March) nextMonth=apr;;
|
|
|
|
apr|Apr|april|April) nextMonth=may;;
|
|
|
|
may|May) nextMonth=jun;;
|
|
|
|
jun|Jun|june|June) nextMonth=july;;
|
|
|
|
jul|Jul|july|July) nextMonth=aug;;
|
|
|
|
aug|Aug|august|August) nextMonth=sep;;
|
|
|
|
sep|Sep|september|September) nextMonth=oct;;
|
|
|
|
oct|Oct|october|October) nextMonth=nov;;
|
|
|
|
nov|Nov|november|November) nextMonth=dec;;
|
|
|
|
dec|Dec|december|December) nextMonth=jan; year=$((year + 1));;
|
|
|
|
esac
|
|
|
|
|
|
|
|
end=$(date -Is --date="0:00 ${nextMonth} 1 ${year}")
|
|
|
|
|
|
|
|
|
|
|
|
header1="=====TIMESHEET FOR $(echo ${start} | awk -F\- '{print $1"-"$2}')====="
|
|
|
|
header2="=====COMPLETE LOG====="
|
|
|
|
|
|
|
|
echo ${header1}
|
|
|
|
echo
|
|
|
|
|
|
|
|
zeit list --since ${start} --until ${end} --total --no-colors | tail -n2
|
|
|
|
|
|
|
|
for p in $(zeit list --since ${start} --until ${end} --only-projects-and-tasks --no-colors | grep ◆ | awk '{print $2}'); do
|
|
|
|
echo "${p}:"
|
|
|
|
echo "\t$(zeit list --since ${start} --until ${end} --project ${p} --total | tail -n2 | cut -f2- -d ' ')"
|
|
|
|
done
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo ${header2}
|
|
|
|
echo
|
|
|
|
|
|
|
|
for e in $(zeit list --since ${start} --until ${end} --no-colors | awk '{print $1}'); do
|
|
|
|
zeit entry ${e} --no-colors | awk NF
|
|
|
|
echo
|
|
|
|
done
|