I'm trying to use taskwarrior to track time for billing purposes.
To do that I'm trying to generate a report showing the hours spend on each task. The standard completed report gives the Created and Completed dates but not times, so I cant see how many hours were spent on the task.
$ task completed project:test
ID UUID Created Completed Age Project Description
- fed3daca 2019-09-29 2019-09-29 10min test test1
- 31a8f13e 2019-09-29 2019-09-29 1min test test2
2 tasks
Is this something taskwarrior can do? Thanks
I don't think taskwarrior can create those reports by itself, but you could use timewarrior to do that.
After you set up timewarrior, the time spent on each task will be tracked. Example:
➜ ~ task add reply on stack overflow
Created task 341.
➜ ~ task start 341
Starting task 81b73133 'reply on stack overflow'.
Started 1 task.
Tracking "reply on stack overflow"
Started 2020-04-10T12:07:58
Current 59
Total 0:00:01
➜ ~ task 341 done
Completed task 81b73133 'reply on stack overflow'.
Completed 1 task.
Recorded "reply on stack overflow"
Started 2020-04-10T12:07:58
Ended 09:12
Total 0:01:14
By default you will see how much time you spent on the task. In case you start and stop the task multiple times or want to see the time you spent on a project or on tasks with a certain tag, you can query timewarrior directly:
➜ ~ timew summary 'reply on stack overflow'
Wk Date Day Tags Start End Time Total
W15 2020-04-10 Fri reply on stack overflow 12:07:58 12:09:12 0:01:14 0:01:14
0:01:14
This shows you the time you spent today on that task. You can also specify a time interval in case you want to see the total time spent on the task/project/tag. Example:
➜ ~ timew summary 2020-01-01 - tomorrow 'reply on stack overflow'
Wk Date Day Tags Start End Time Total
W15 2020-04-10 Fri reply on stack overflow 12:07:58 12:09:12 0:01:14 0:01:14
0:01:14
To see how much time you spent on project test
you can just run:
timew summary 2018-01-01 - tomorrow test
This will also include the tasks named 'test' and tasks with the tag test
.
As mentioned by Tom Dörr use timewarrior to summarize by tags.
This is the way I do:
timew tags :week
timew tags :week | tail -n+4
timew tags :week | tail -n+4 | awk 'BEGIN {FS="-"}; {print $1}'
This results in a list of tags for the selected date range, each in one line. Now you can use a script (for example summarize.sh
) to loop through these tags to summarize:
#!/bin/bash
while read TAG; do
[ "${TAG}" = "" ] && continue
timew summary :week "${TAG}"
done < <(timew tags :week | tail -n+4 | awk 'BEGIN {FS="-"}; {print $1}')
This way you can handle tags containing whitespace also.
At least, run a loop in shell/bash to update permanently, for example every second:
while :; do clear; date; ./summarize.sh; sleep 1; done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With