Controlling time with the command line

In his last post, Matt told us about his time management setup using Things and the Pomodoro technique. This featured things like “GUIs” and “iPads”. I however am a person of unsophisticated pleasures – give me a copy of zsh and a few applications and its all good. You can even use the Pomodoro technique if you like.

Much more after the jump!

Tracking Tasks – Todo.sh

More a way of life than a set of shell scripts, Todo.sh was developed by Gina Trapani as the ultimate in simplistic task management. Todo.sh is basically an interface to Todo.txt task tracking system. Todo.txt means keeping a text file somewhere that contains your tasks, one per line in a very loose format – the date and then the task. When you’ve finished a task, you add an `x` by it in front of the date. If you want to get really clever, you can add priority and GTD style contexts and projects, using alphabetical characters in brackets in indicate priority and @ and + signs to link together contexts and projects respectively. The advantages of this system are simplicity and portability – there is no computer system on earth than cannot edit a text file. Given an editor, you can keep your tasks managed.

Todo.sh (AKA TODO.TXT Command Line Interface) is a shell script that manages this file. So adding a task you run `todo.sh add The task I want to do`, to show what tasks you have outstanding you run `todo.sh ls` and to complete a task you run `todo.sh do #numberoftask`. Simplicity itself – but todo.sh has a few extra options to edit, delete, archive and report on tasks. Equivalents are available in just about any language you fancy.

Tracking Time – Punch.py

Punch.py is a time tracking application for the command line. There are a few out there, but Punch.py seems to suit my needs and, more to the point, integrates with Todo.txt. The original repository over at Google Code seems to be abandoned, but someone put it up at Github and I forked it to make a few changes to make it easy to use out of the box.

Punch.py couldn’t be more easy to use. Locate your task by its number in todo.sh, then tell the shell ‘punch in 12` to begin working on the 12th task in your list. Then when you are pausing this task, issue a `punch out` and the time you spent on the task is recorded. A simple `punch report` will tell you what you’ve been working on for the last few days. When this gets too long, you can use `punch archive` to keep your records, but get a basically clean slate. Very nice – very clean and very simple. I intend to tick out the code in the next few weeks as there are a few gotchas – in particular I don’t like the way it isn’t add up the time spent on tasks overall.

Putting It Together – zsh and Visor

zsh is my shell of choice and it should be yours too – as well its awesome speed and autocompletion this is partly because the Oh My Zsh project drags theming the shell into the 21st century.

Typing `todo.sh ls` to get your list of tasks gets pretty tiresome after a while – as does typing punch in/out – so I threw in a load of aliases. Among other things I alias `td ls` to simply `td`, `td add` to `a` and `td. I actually didn’t like the `td ls` printed out the tasks, so I pipe this baby through `sort` and `awk` to get it just so.

Using a couple of shell functions, I . On the left of my screen I have the total number of outstanding tasks. If I am currently running a task in Punch.py, then I am told right on my command line – just to remind me what is going on. Its a pretty neat setup – but how can I access it globally?

I need to access the terminal pretty globally anyway in Mac OS, so I throw the project-formerly-know-as-Visor TotalTerminal into the mix. TotalTerminal provides a first person shooter style interface to your terminal anywhere by hitting a key stroke. Its like Quake terminal you used to type “GOD” into when the going got tough. Naturally you can get something similar on KDE (Yakuake) or Gnome (Guake) for Linux, for Windows and other windowing systems too. I alias mine to Ctrl + Space (for the interested Ctrl + Space is TotalTerminal, Alt + Space is Spotlight, Apple + Space is Alfred). So if I want to start, add, or complete a task, its just a few keystrokes away.

My computer is, of course, named after Gilles Deleuze.

Tomatoes Ahoy

Yes, but I want to use the time tracking technique influenced by Henri Bergson’s theories of internal time consciousness (PDF) – the Pomodoro technique! Well you can do that too. I don’t personally use the Pomodoro technique, but have in the past and it really does focus one’s attention.

On the command line here you are spoilt for choice. redpomo integrates with Redmine issue tracking and Todo.sh – if we used Redmine I might be tempted. Someone has even done a very simple one in shell script. For my money, pomo is likely the best. Written in Ruby by the brilliant TJ Holowaychuk, it even integrates with Growl to let you know when your pomodoro period is up.

However, pomo doesn’t use todo.txt, which just makes me sad. I’ll likely fork redpomo and strip out the Redmine elements and use it with our own ticketing system.

By Way Of Conclusion: Thinking Unix

So my complete setup uses shell scripting, Python and potentially Ruby all integrated seamlessly with the shell as glue. This is all very much in line with the simplicity of the Unix philosophy. Tools should do one thing and do it well. They should produce data in text streams that can easily be manipulated by other programs doing other single things well pushed from one to another by pipes.

Designers these days tend to push for simplicity as a major virtue when designing web application UX quite rightly. Simplicity is precisely what the Unix philosophy teaches. Thinking about the command line, by stripping back  UI bells and whistles and considering the Unix philosophy forces you to focus on “does this do one thing and do it well”. Chaining together things that do “one thing well” means you have a loosely coupled application which does everything well.

The same principle should be one of the first things one thinks when approaching a web application. 37signals have already made roughly the same point in their famous (but occasionally frustrating) “Build Less”. Sometimes doing less, being more simple, can be what makes your work better if it does those few things very well indeed. This is the lesson from Unix that simple utilities like todo.sh teach.

Leave a Reply

Your email address will not be published. Required fields are marked *