|
|
@ -6,35 +6,44 @@ source $0:A:h/ttyhelper.sh |
|
|
|
|
|
|
|
|
function tasksallsince() { |
|
|
function tasksallsince() { |
|
|
[[ $# -lt 1 ]] && return 1 |
|
|
[[ $# -lt 1 ]] && return 1 |
|
|
local DATE=$1 |
|
|
|
|
|
shift |
|
|
|
|
|
taskuuids \( \( \( +COMPLETED or +DELETED \) end.after:$DATE \) or \ |
|
|
|
|
|
+PENDING \) $@ |
|
|
|
|
|
|
|
|
taskuuids \(\(\( +COMPLETED or +DELETED \) end.after:${1} \) \ |
|
|
|
|
|
or +PENDING \) $@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function datetimedescription() { |
|
|
function datetimedescription() { |
|
|
for UUID in $(tasksallsince 2018-03-31) |
|
|
|
|
|
|
|
|
[[ $# -lt 1 ]] && return 1 |
|
|
|
|
|
for UUID in $(tasksallsince $@) |
|
|
do |
|
|
do |
|
|
DESCRIPTION="$(taskdescription $UUID)" |
|
|
DESCRIPTION="$(taskdescription $UUID)" |
|
|
PROJECT="$(taskproject $UUID)" |
|
|
PROJECT="$(taskproject $UUID)" |
|
|
|
|
|
COMPLETED="$(taskuuids $UUID \( +COMPLETED or +DELETED \))" |
|
|
for T in $(tasktimes $UUID) |
|
|
for T in $(tasktimes $UUID) |
|
|
do |
|
|
do |
|
|
extracttime $T |
|
|
extracttime $T |
|
|
printf "%s;%s;%s;%s\n" $TIMEKEY $TIME $PROJECT $DESCRIPTION |
|
|
|
|
|
|
|
|
printf "%s;%s;%s;%s;%s\n" \ |
|
|
|
|
|
$TIMEKEY $TIME $PROJECT $DESCRIPTION $COMPLETED |
|
|
done |
|
|
done |
|
|
done |
|
|
done |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function report() { |
|
|
function report() { |
|
|
for LINE in "${(f)$(datetimedescription|sort -t\; -k1)}" |
|
|
|
|
|
|
|
|
[[ $# -lt 1 ]] && return 1 |
|
|
|
|
|
local D DATE T |
|
|
|
|
|
DATE=$1 |
|
|
|
|
|
for LINE in "${(f)$(datetimedescription $@|sort -t\; -f -k1,1 -k3,3)}" |
|
|
do |
|
|
do |
|
|
set -- ${(s(;))LINE} |
|
|
set -- ${(s(;))LINE} |
|
|
if [[ $DATE != $1 ]] |
|
|
|
|
|
|
|
|
if [[ -n $1 && $(date -d $1 +%s) -ge $(date -d $DATE +%s) ]] |
|
|
then |
|
|
then |
|
|
DATE=$1 |
|
|
|
|
|
printf "%s\n" $(underline "" $DATE) |
|
|
|
|
|
|
|
|
if [[ $D != $1 ]] |
|
|
|
|
|
then |
|
|
|
|
|
D=$1 |
|
|
|
|
|
printf "%s\n" $(underline "" $D) |
|
|
|
|
|
fi |
|
|
|
|
|
T=$2 |
|
|
|
|
|
if [[ -n $5 ]] && T=$(bold "" $T) |
|
|
|
|
|
if [[ -n $D ]] && printf "%s [%s] - %s\n" $T $3 $4 |
|
|
fi |
|
|
fi |
|
|
printf "%s [%s] - %s\n" $(bold "" $2) $3 $4 |
|
|
|
|
|
done |
|
|
done |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -44,15 +53,57 @@ function usage() { |
|
|
|
|
|
|
|
|
OPTIONS: |
|
|
OPTIONS: |
|
|
-?, --help Show this help |
|
|
-?, --help Show this help |
|
|
|
|
|
-d, --date DATETIME is a date and time identifier as accepted by the |
|
|
|
|
|
date command. It specifies how long back done tasks |
|
|
|
|
|
should be considered. |
|
|
|
|
|
|
|
|
FILTER can be additional taskwarriors filters to limit the result |
|
|
FILTER can be additional taskwarriors filters to limit the result |
|
|
any further. |
|
|
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 |
|
|
USAGE |
|
|
) |
|
|
) |
|
|
/usr/bin/printf "${USAGE}\n" $0 |
|
|
/usr/bin/printf "${USAGE}\n" $0 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# |
|
|
|
|
|
# parse command line arguments |
|
|
|
|
|
# |
|
|
|
|
|
SHORTOPTS=?d: |
|
|
|
|
|
LONGOPTS=help,date |
|
|
|
|
|
ARGS=$(getopt -o ${SHORTOPTS} --long ${LONGOPTS} -n report -- $@) |
|
|
|
|
|
if [ $? -ne 0 ] |
|
|
|
|
|
then |
|
|
|
|
|
usage $0 |
|
|
|
|
|
exit 1 |
|
|
|
|
|
fi |
|
|
|
|
|
eval set -- ${=ARGS} |
|
|
|
|
|
unset ARGS |
|
|
|
|
|
|
|
|
|
|
|
while true |
|
|
|
|
|
do |
|
|
|
|
|
case $1 in |
|
|
|
|
|
'-?'|'--help') |
|
|
|
|
|
shift |
|
|
|
|
|
usage $0 |
|
|
|
|
|
exit 0 |
|
|
|
|
|
;; |
|
|
|
|
|
'-d'|'--date') |
|
|
|
|
|
DATEFROM=$(date -d ${2} +%Y-%m-%d) |
|
|
|
|
|
shift 2 |
|
|
|
|
|
continue |
|
|
|
|
|
;; |
|
|
|
|
|
'--') |
|
|
|
|
|
shift |
|
|
|
|
|
break |
|
|
|
|
|
;; |
|
|
|
|
|
*) |
|
|
|
|
|
echo 'Internal error!' >&2 |
|
|
|
|
|
exit 1 |
|
|
|
|
|
;; |
|
|
|
|
|
esac |
|
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
DATEFROM=${DATEFROM:-$(date +%Y-%m-01)} |
|
|
|
|
|
report $DATEFROM $@ |
|
|
|
|
|
#datetimedescription $DATEFROM $@|sort -t\; -f -k1,1 -k3,3 |
|
|
|
|
|
|
|
|
# vim: set et ts=4 sw=4: |
|
|
# vim: set et ts=4 sw=4: |