Skip to content

Instantly share code, notes, and snippets.

@iateadonut
Last active March 21, 2022 11:37
Show Gist options
  • Save iateadonut/719221bbaea5e747d86fe6c33aaa4e66 to your computer and use it in GitHub Desktop.
Save iateadonut/719221bbaea5e747d86fe6c33aaa4e66 to your computer and use it in GitHub Desktop.
time warrior - find all tags associated with a tag, then find how much time was spent on each of those tags
#!/bin/bash
#time warrior tag summary
while IFS= read -r line;do
tag="${line// -/ }"
tag=`echo $tag`
command="timew \""$1"\" \""$tag"\" summary :month"
response=$(echo `timew \""$1"\" \""$tag"\" summary :month | tail -n 2 | head -n 1`)
[[ $response = "No filtered data"* ]] && response="No data"
printf "%-50s - %-30s\n" "$tag" "$response"
done < <(timew tags :month "$1" | tail -n +4 | head -n -1)
@iateadonut
Copy link
Author

I tag tasks in task warrior with customer names, so I may have +customer +task1 +task2 +task3, etc.

I wanted to get the time spent on each task this month without getting getting the summary of each tag, so basically I want the output of:
twts customer
to give me a list of task1, task2, task3 and the time spent on each one.

So I made this bash script: I hope someone finds it useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment