Wed 09 April 2014

Managing tasks and generating timesheets using taskwarrior

Posted by ankur in Tech (445 words, approximately a 2 minute read)

A while back, I had blogged on how one can use gtg and hamster-time-tracker to manage their tasks, and track them. Now, I personally prefer the terminal. A few days ago, I was talking to threebean and he pointed me to his time sheet. Helpful as always, threebean told me how he'd generated the time sheet. I document the steps here for any one else that's interested in doing the same.

What you need

$ sudo dnf install ansi2html task #use yum if you prefer

This will provide you with the task command. Read the quick tutorial on using it here. As usual, RTFM at `` $ man task``.

Generating time sheets

Then, you need two shell scripts. The first, generates your time sheet from task:

# File :
# This generates timesheet data for my fedora tasks only

source /home/<USER>/.bashrc

start=$(date +$fmt -d $phrase)
end=$(date +$fmt)

echo " (generated at $(date))"
echo " -- Tasks completed from $start to $end (back $phrase) -- "
/usr/bin/task work_report $filter end.after:$start

echo " -- Upcoming tasks -- "
/usr/bin/task next $filter

echo " -- Blocked tasks -- "
/usr/bin/task blocked $filter

echo " -- Blocking tasks -- "
/usr/bin/task blocking $filter

echo " -- Summary -- "
/usr/bin/task summary $filter

echo " -- History -- "
/usr/bin/task history $filter
/usr/bin/task ghistory $filter
/usr/bin/task burndown.daily
/usr/bin/task burndown

The second just converts it into an html file that you can host. This one looks like this:

# File :
# Generates reports from my task data


today=$(date +%Y-%m-%d)
/home/<USER>/bin/ | ansi2html > /tmp/timesheet-fedora.html
/home/<USER>/bin/ | ansi2html > /tmp/timesheet-all.html
cp /tmp/timesheet-fedora.html ~/timesheets/$today.html
cp /tmp/timesheet-fedora.html ~/timesheets/latest.html

cp /tmp/timesheet-all.html ~/timesheets/$today-all.html
cp /tmp/timesheet-all.html ~/timesheets/latest-all.html

scp -i /home/<USER>/.ssh/id_fedora_rsa /tmp/timesheet-fedora.html <FAS USER>$today.html
scp -i /home/<USER>/.ssh/id_fedora_rsa /tmp/timesheet-fedora.html <FAS USER>
rm /tmp/timesheet*.html

This will generate a pretty time sheet for you, like the one threebean hosts, or the one I host. Taskwarrior is quite the same as gtg. I've moved to it because I prefer using the terminal as much as possible, and it lets me create sheets where I can keep an eye on my tasks. Yes, I'll continue to maintain gtg in Fedora. Don't worry ;)

Customizing your time sheet

You can customize your time sheets and other options by creating a ~/.taskrc file. More themes are available in /usr/share/doc/task/rc/

My .taskrc looks like this:

# Files


include /usr/share/doc/task/rc/dark-blue-256.theme

report.work_report.labels=priority,project,description,completed,entered on,age

Play around with it. There's quite a bit you can do.

Some more: taskserver

I haven't tried this out myself. I don't need it yet. However, you can run a taskserver on your host and log tasks from anywhere over the internet. Documentation can be found here. If you do figure it out, please write a blog post documenting it for Fedora. threebean's working on the taskd package already.