My key requirements were
- the syntax should be as close to simply writing a note to yourself as possible
- it has to be easy to add or remove something from a todo list wherever you are in the filesystem
- it should be easy to add or remove a task based on previous tasks added
- it should not make changes to a file that you are editing manually
- it should not rewrite the file each time a change is made, if possible
The commands to add and remove tasks are one-liner bash scripts to echo the command line to ~/.todo, basically. ++
is add, xx
is remove. (You can name them whatever you like, of course.)
So
$ ++ personal, start the great american novel
$ xx freelance myproject, refactor the frobosh modules
results in two records added to ~/.todo :
+ [Tue Sep 20 12:10:13 EDT 2011] personal, start the great american novel
- [Tue Sep 20 12:10:50 EDT 2011] freelance myproject, refactor the frobosh modules
Anything before the first comma is treated as categories, anything after is the task itself.
So this gives you basically a log file. Then I wrote a little Ruby program to parse this and output to yaml (among other things).
I decided I wanted to use bash autocompletion to much the same effect as select menu autocompletion -- as you type it narrows down the choices to previously-entered tasks. Also, the ruby parser matches on the start of the line, so you can just type as much of the line as you need to make it unique and it will handle the rest.
Also I wrote another little bash tool called ==
for append-editing:
$ ++ personal, start the great american novel
$ == -a 'novel$' 'tomorrow'
This gives you a '-' and '+' record:
- [Tue Sep 20 14:15:38 EDT 2011] personal, start the great american novel
+ [Tue Sep 20 14:15:39 EDT 2011] personal, start the great american novel tomorrow
Of course for total flexibility you could just use sed to edit the file in-place, too.
So with these building blocks you could easily do something like
- set a directory watcher on the .todo file and automatically redisplay a current todo list as it's edited (see example below)
- serve up the .todo file through a web app and provide a GUI for adding tasks
- stream it to loggly or PubSubHubbub it
- parse it into commands to send to your arduino-controlled personal robot over IRC
etc....
It's not rocket science and I've taken ideas from others, but it could be useful. I'm especially happy about the autocompletion, which is such a timesaver. Also it gave me a chance to struggle with bash which I've been wanting to do.
Note that the ruby program below is just the basic idea. I have expanded it to include parsing out various things from the task description, using a markup format kinda similar to todo.txt, but simplified. I have person tags (@eric
), other tags (=done
), time estimates (~1h30m
), and absolute or relative dates (due mon
, started 1-Oct-2011
), all of which can appear anywhere in the task description. (The only fixed thing is the categories which appear in the front.)
I've also split out the display methods into presenter classes and run them through Tilt templates. But all of this is a bit too much to put in a gist, so I left it simple, I'll put up the full code after CodeBrawl ends...
Really liking the simplicity of this.. and of course the bash completion is a plus for me.. :D