Wednesday, February 22, 2012

Organizing my world with taskwarrior and org-mode

For organizing my world i use to tools. First taskwarrior for creating an working with tasks and emacs org-mode for writing documentation. I know there is a option to use org-mode for tasks too but this is not useful for my workflow. I prefere to use taskwarrior.

The only missing thing in taskwarrior ist that i cannot add some descriptions for a task. This is the point were org-mode comes into the spot. I wrote a litte script which creates a note for a task. I call this script taskcomment.

Here you can see the short version of the code:
FOLDER=${WIKI}/tasks/comments
UUID=`task rc._forcecolor=no rc.defaultwidth=300 $1 | \
      grep UUID | grep -o "[-a-f0-9]*\$"`
TITLE=`task $1 | grep Description | sed 's/^Description\ //g'`
FILE="${UUID}.org"

if [ ! -f ${FOLDER}/${FILE} ]; then
    echo "#Title: ${TITLE}" > ${FOLDER}/${FILE}
    echo "#+STARTUP: showall" >> ${FOLDER}/${FILE}
    /usr/bin/task append $1 '[c]'
fi

${EDITOR} ${FOLDER}/${FILE}
First I check the UUID for a given task. The script taskcomment will have an available ID of a task. The UUID will be produced by taswarrior for giving an unique identifier for all its tasks. I take this UUID and name my files in that case.

The second line shows how to I get the title of the task. The title is important for the closed tickets because taskwarrior rearranges its tasks already new after closing one ticket. So the closed tickets do not have an ID. This is a problem which I have to solve in the near future because if you have a closed ticket you have to activate it that it becomes a new ID and then can you work with it. After that you already have to close this ticket. That's very bad style.

Afterwards the script checks if the comment file is a new file or not. If it is a new file it will create some useful comments at the top of the file.

If you want to work with that script you could start it like:
$ taskcomment 5
Next the script adds a '[c]' to the description line of the task to show there is a comment attached to this task. I found it nicer to do it in that way because it is much nicer and compact instead working with annotations. Here you can see an output of the taskwarrior with my extensions:
% task 
[task list]

ID Project Pri Due       Active Age    Description                                                                 
11 test        24.2.2012        14 hrs Testentry
 3 test    M   11.3.2012        16 hrs Testentry with comment [c]   

The comment file will be opened in my case with Emacs in org-mode because I use the extension .org for opening files. That's the way I work with taskwarrior and Emacs in org-mode for organizing my world ;)

1 comment:

  1. Currently there is a way to avoid this problem with completed tasks in the version 2.0 of the taskwarrior.
    http://taskwarrior.org/boards/1/topics/1817

    ReplyDelete