When the TaskRatchet alpha started, I thought I had a clever idea of how I’d use it. I really wanted to integrate with it via API, to be able to set myself tasks via the command line.
Now, TaskRatchet didn’t officially expose an API per se, but that wasn’t going to stop me. Fine, it doesn’t have a nice clean proper JSON-over-HTTP API, but it does have something which is effectively a plaintext-over-SMTP API! I could write a CLI tool that speaks SMTP, which I could use to set tasks in TaskRatchet for myself!
Well, in retrospect, that was rather overambitious, and by the time I got something half complete, @narthur paused the alpha. Oops. I didn’t even get around to signing up.
But I still wanted to have that CLI tool for setting tasks for myself, so I kept working on what eventually turned into perhaps the simplest possible competitor to TaskRatchet. At its core, it’s a very short bash script whose core is something like this:
while read amount description; do curl 'https://www.beeminder.com/api/v1/charges.json' \ -d auth_token=my_api_token_here \ -d amount="$amount" \ -d note="$description" done < ~myusername/tasks
(This code is released under the MIT license.)
I dropped this script into
/etc/cron.daily on my laptop, so that it will run as a daily cron job. (In my case, via
In short, what it does is read a file named
tasks in my home directory, which is formated along the lines of:
1 Wash the dishes 5 Go to dentist appointment
(i.e. a dollar amount and then a description.)
Each time I complete a task, I remove it from this file. For each task left in the file at the end of the day, the above script charges me the listed amount.
This is very simple and quite barebones. It doesn’t even have a way to configure when tasks are due by! And it requires me to clean up failed tasks manually the next morning. (I could easily fix that by adding a line like
truncate -s 0 ~myusername/tasks to the end of the script, but I actually like the notion of having to pay some attention to considering my failed tasks.)
For all that, it works surprisingly well. I haven’t failed at achieving a task I set myself this way so far (in about a week of use), and I’ve accomplished things which I know I definitely would have procrastinated on otherwise.
I’m looking forward to using TaskRatchet when it’s ready, which from my point of view is when it can clearly beat this script in features and ease of use. (Which shouldn’t be hard: there are a lot of features this lacks. But it definitely needs to have an easy way of setting myself tasks via CLI.)