May 24, 2008 Archives

Sat May 24 22:36:50 CDT 2008

Todo.txt - Using a text file to manage tasks.

As long as I can remember, I've used a text file for my todo list. I keep one at home that collects short-term goals like grocery shopping. Sometimes I use it for a scratchpad for URLs and random thoughts. I keep another one at work to remind me of hostnames, ip addresses, names, extensions, and anything else I need for a service call. Since switching to Linux, I've gotten away from having to keep my personal todo.txt on my thumbdrive. In fact, I've gotten away from using a text editor on it almost entirely.

Gina Trapani of Lifehacker maintains a small script to manage your todo list. Todotxt.org has the main bash script (todo.sh) along with several tools to integrate with it, including progress trackers, tab completion, and bots for Jabber and AIM. If bash isn't your language of choice, there is also a Python version. You can see a video demo of todo.sh on Youtube.

More than anything, I find myself using my todo.sh to manage a grocery list. Moriah and I leave it open on the computer so that we can add eggs or bread easily when we run low. To keep grocery items separate from "rake leaves" and "build workbench" we mark them with "@buy", which has the bonus of sorting them near the top of the list, all together. Then, we can view the list of groceries with this command:
$ todo.sh list @buy
23 @buy bread
22 @buy contact solution
19 @buy juice
20 @buy mayo


The cut[0] command, built into the GNU coreutils, makes it easy to grab just the important parts of that output.
$ todo.sh list @buy | cut -f3- -d" "
bread
contact solution
juice
mayo


Finally, I can pipe the output into lpr and print it.
$ todo.sh list @buy | cut -f3- -d\ | lpr

Next time, I'll go over the php script that I use as an interface to the shell script.

[0] Here, I use cut with two flags. -f3- means "from third field to end of line" and -d specifies the delimiter. Here I delimit with spaces, which you can quote or escape with a backslash.

Posted by Nesman | Permanent Link