Skip to content
This repository has been archived by the owner on Nov 8, 2017. It is now read-only.

Dep (action)

Bram Schoenmakers edited this page Aug 28, 2013 · 2 revisions

dep is an extension for the todo.txt CLI to manage dependencies between tasks. This is achieved by adding id and p (parent) tags to your tasks. It will maintain its own task numbering rather than the regular task numbers, so it's resilient against sorting and deletion operations. Note however, that if you use the dep subcommand there's no need to worry about these numbers, just use the task numbers as you're used to.

So in your todo.txt file you'll see something like this:

(B) Call mom id:1
(B) Buy telephone p:1

So this means that you first have to buy a telephone before you can complete the parent task. A task always refers to its parent(s), parents never refer to their children.

The synopsis for the dot subcommand as follows:

todo.sh dep add TASK# to TASK#
todo.sh dep rm TASK# to TASK#
todo.sh dep ls TASK# to
todo.sh dep ls to TASK#
todo.sh dep gc TASK#
todo.sh dot [ TASK# | TEXT ]

The add and rm subcommands add and remove a dependency between two tasks. So 1 to 2 means that 1 depends on 2, i.e. that 2 has to be completed before 1 can.

You can show the dependencies between two tasks with the ls subcommand. With the TASK# to notation you list all outgoing tasks (i.e. depending tasks), with to TASK# you list all tasks which depend on the given task.

gc stands for garbage collection and does three things:

  • remove id tags which are no longer referred to;
  • remove p tags pointing to non-existent tasks;
  • performs transitive reduction on your graphs. This basically means that obsolete dependencies are removed. In the image below, the dependency from 1 to 3 is a candidate for removal, since 3 is already a subtask of 1 via task 2.

With dot you can visualize the dependencies of your tasks in a directed graph. This subcommand generates output suitable for the dot(1) command. If you have graphviz installed, you can generate an image by executing:

todo.sh dep dot | dot -Tpng -o todo.png

Result:

Example dependency graph.

Note that you can narrow down the scope of the directed graph by specifying a task number or a text filter after the dot subcommand. This way, you can filter only those tasks belonging to a certain project or context:

todo.sh dep dot +ProjectX
Clone this wiki locally