Brian’s Brain

I Need a Tagline

Todo.Txt Implementation in PowerShell

Installation

Copy the zip file and extract the contents to your PowerShell modules directory.

Description

Inspired by todotxt.com, this set of scripts helps manage a simple todo.txt file. The scripts will help parse your todo.txt file if you adhere to the following simple rule: One line per task.

In addition, the scripts will try to parse interesting “metadata” about your tasks. The scripts will look for metadata in parenthesis. Here’s what the scripts will look for:

  • A single character is interpreted as a priority. This lets you use ‘A’, ‘B’, ‘C’, ‘1’, ‘2’, ‘3’, ‘!’, or any other single character prioritization.

  • A word that starts with an “@” sign is interpreted as a “context” in the “Getting Things Done” definition. Examples include “@phone”, “@computer”.

  • A word, then a colon, then text is interpreted as a property/value pair. Example: “project: foo”.

You can put multiple pieces of metadata in a single parenthesis, separated by commas. For instance, “(A, @call, project: foo)” would be parsed as a priority, a context, and a property/value pair.

The scripts manipulate the line items by wrapping them in BDewey.ToDo custom PSObjects, with the relevant bits of metadata stuck on to the object. By parsing out the metadata and sticking it on objects, it’s easier to manipulate the todo items using existing PowerShell cmdlets, like sort-object and where-object.

The most important property on the object is Item, which contains the verbatim line from the file.

The easiest way to use these scripts is to declare a variable $TodoFile and point it at the todo.txt file you want to use.

Included Cmdlets

  • Add-Todo
  • Archive-Todo
  • Backup-Todo
  • Do-Todo
  • Get-Todo
  • Log-Todo
  • Out-Todo
  • Remove-Todo
  • Set-Todo
  • Split-Todo