How I keep track of my to-dos using plain text
There are plenty of applications that track to-dos. From simple applications that just store your todos to full featured multi-user platforms. But in most cases all you need is a simple text file which you can format to your preference. I love the simplicity of text files. The choice of formatting is up to one’s imagination.
I have one file with each line representing a todo. If the line starts with a —
I consider it to be incomplete and a +
denotes its complete. It is a simple principle and the Unix environment has several tools to help me sort and organize this. But when I want to synchronize this with my mobile the problem begins. Despite having several tools to synchronize files it is quite a task to replicate the scriptable Unix environment. And this is where Saola comes in.
Saola, for the uninitiated is a scriptable notes platform. You can extend your plain text notes with scripts written in JavaScript. This is quite familiar to what you would do on a Unix box. It renders your text as markdown so you have some formatting. Let me show you how I work with todos using Saola.
I have one file named Todos and it looks like this:
### Todo
- Book flights to Paris #travel
- Read "Practical Common Lisp" #book
- Create an account on Saola https://saola.in/#register
- Read Gödel, Escher, Bach: An Eternal Golden Braid #book
- Watch The Martian #movies
### Done
+ Send email to Ross
+ Finish recording this video #task
### Meta
* Cleanup: https://saola.in/#x/demo/jmwmbihesq
Saola renders it as:
But as you can see maintaining this list would be quite cumbersome. When I complete a task I would have to change the —
to a +
and then move it to the ### Done
section. With Saola this becomes easy as all I have to do is write a script that automatically reorganizes the file. So I can change the —
to a +
when I am done with a task and execute the script that reorganizes the file. Here is the script that I use to reorganize the file:
var fileName = "demo/b453vgmgq4";
var original = saola.read(fileName);
var content = original.content;
var todos = content.match(/[^\r\n]+/g);
var undone = [];
var done = [];
var meta = [];
for (var i=0; i<todos.length; i++) {
var todo = todos[i];
if (todo[0] === "-" ){
undone.push(todo);
} else if (todo[0] === "+") {
done.push(todo);
} else if (todo[0] === "*") {
meta.push(todo);
}
}
var content = "### Todo\n";
for (var i=0; i<undone.length; i++) {
content += undone[i] + "\n";
}
content += "### Done\n"
for (var i=0; i<done.length; i++) {
content += done[i] + "\n";
}
content += "### Meta\n"
for (var i=0; i<meta.length; i++) {
content += meta[i] + "\n";
}saola.update(fileName, content);
println("**Updated** https://saola.in/#", fileName);
As you can see Saola exposes a few functions that help in reorganizing the file: saola.read
, saola.update
and println
. The above script moves all lines starting with —
to ### Todo
, +
to ### Done
and *
to ### Meta
sections respectively.
Since I have added tags in the todos with #
I can also write a script to sort according to tags.
var content = saola.read("demo/b453vgmgq4").content;
var todos = content.match(/[^\r\n]+/g);
var undone = {};
for (var i=0; i<todos.length; i++) {
var todo = todos[i];
if (todo[0] !== "-") continue;
var tags = todo.match(/\#[a-zA-Z]+/g);
if (tags === null || tags === undefined){
tags = ["#rest"];
}
for (var t=0; t<tags.length; t++) {
var tag = tags[t].replace("#", "");
if (undone[tag] === undefined){
undone[tag] = [];
}
undone[tag].push(todo);
}
}
for (var key in undone) {
if (!(undone.hasOwnProperty(key))) {
continue;
}
var todos = undone[key];
if (todos === undefined) continue;
println("**", key, "**");
for (var i=0; i<todos.length; i++) {
var todo = todos[i]
if (key !== "rest") {
todo = todo.replace("#"+key, "");
}
println(todo);
}
println("");
}
println("https://saola.in/#demo/b453vgmgq4");
Running this script produces:
Having a scriptable platform allows you to create workflows that would be impossible with usual tools. I keep track of expenses, list of books I need to read, articles that I want to read later and several other things. I just love the simplicity.
Give it a try, register at https://saola.in/#register or try it without registering try it out here: https://saola.in/#tk/bac3lryfdohxim3yhfckalaxzggeby6a