report.sh
1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/zsh
source $0:A:h/datetimehelper.sh
source $0:A:h/taskhelper.sh
source $0:A:h/ttyhelper.sh
function tasksallsince() {
[[ $# -lt 1 ]] && return 1
local DATE=$1
shift
taskuuids \( \( \( +COMPLETED or +DELETED \) end.after:$DATE \) or \
+PENDING \) $@
}
function datetimedescription() {
for UUID in $(tasksallsince 2018-03-31)
do
DESCRIPTION="$(taskdescription $UUID)"
PROJECT="$(taskproject $UUID)"
for T in $(tasktimes $UUID)
do
extracttime $T
printf "%s;%s;%s;%s\n" $TIMEKEY $TIME $PROJECT $DESCRIPTION
done
done
}
function report() {
for LINE in "${(f)$(datetimedescription|sort -t\; -k1)}"
do
set -- ${(s(;))LINE}
if [[ $DATE != $1 ]]
then
DATE=$1
printf "%s\n" $(underline "" $DATE)
fi
printf "%s [%s] - %s\n" $(bold "" $2) $3 $4
done
}
function usage() {
local USAGE=$(cat <<-USAGE
Usage: %s [-?] [DATETIME] [FILTER]
OPTIONS:
-?, --help Show this help
FILTER can be additional taskwarriors filters to limit the result
any further.
DATETIME is a date and time identifier as accepted by the date command.
It specifies how long back done tasks should be considered.
USAGE
)
/usr/bin/printf "${USAGE}\n" $0
}
# vim: set et ts=4 sw=4: