Skip to content

Instantly share code, notes, and snippets.

@projectivemotion
Created January 14, 2017 05:21
Show Gist options
  • Save projectivemotion/e9fe6738ca91c7cf32c5cabcb8e60979 to your computer and use it in GitHub Desktop.
Save projectivemotion/e9fe6738ca91c7cf32c5cabcb8e60979 to your computer and use it in GitHub Desktop.
Create a csv report of how much time was spent on each tag for the current month in TimeWarrior. https://taskwarrior.org/docs/timewarrior/what.html
#!/bin/env bash
# only tags without spaces are counted
#
hash JSON.sh 2>/dev/null || {
echo "https://github.com/dominictarr/JSON.sh is required."
exit 1
}
echo \"Tag\",\"Time\"
timew export :month | JSON.sh | grep -E '\[[0-9]+,"tags",' | cut -f2 | grep -v ' ' | sort | uniq | while read tag ; do
echo $tag,\"$(timew summary :month $tag | tail -n2 | grep -Eo '..:..:..' | sed 's/ /0/g')\"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment