tastic sort and archive commands

I’ve recently added some command-line tools to my tastic python package. You can read the original post for installation instruction etc., but for the new bells and whistles read on ….

Command-Line Usage

To view the usage instructions run the command tastic -h from the terminal and you should see:

Documentation for tastic can be found here: http://tastic-for-taskpaper.readthedocs.io/en/stable/

Usage:
    tastic init
    tastic sort <pathToFileOrWorkspace> [-s <pathToSettingsFile>]
    tastic archive <pathToFileOrWorkspace> [-s <pathToSettingsFile>]

Options:
    init                     setup the tastic settings file for the first time
    sort                     sort a taskpaper file or directory containing taskpaper files via workflow tags in settings file
    archive                  move done tasks in the 'Archive' projects within taskpaper documents into markdown tasklog files

    pathToFileOrWorkspace    give a path to an individual taskpaper file or the root of a workspace containing taskpaper files
    -h, --help               show this help message
    -s, --settings           the settings file

Initialising tastic for the First Time

Before you begin using the tastic command-line tools you’ll need to generate your tastic settings file. To setup a default settings file at ~/.config/tastic/tastic.yaml run the command:

tastic init

This should create and open the settings file where you will find a set of workflow tags, which you can adapt to your liking; more on these later.

worflowTags: "@due, @flag, @hold, @next, @someday, @wait"

Sorting Taskpaper Documents with tactic’s Sort Command

It’s probably best to tinker with an example Taskpaper document to show you what these new tastic commands can do. Let’s use the saturday tasks document as our example, download to follow along. Here’s a screenshot of the unsorted file.

Given a list of workflow tags (as found in your settings file), you can recursively sort a document’s projects and tasks via these workflow tags (ordered from most to least prioritised) using tastic’s sort command. For example, to sort the single saturday-tasks.taskpaper file located in my Desktop folder I would run:

tastic sort ~/Desktop/saturday-tasks.taskpaper

Note how projects tagged with @due rise to the top of their parent object, followed by @flag projects and so on. The same is true for tasks. Projects and tasks not associated with any of the workflow tags are sorted after the tagged objects. Also note that the document’s objects are now neatly sorted into notes, then tasks, then projects.

As an extra bonus, if you want to sort ALL of the taskpaper documents recursively contained within a workspace, just pass in the root-path of the workspace:

tastic sort /path/to/my/workspace/

Moving Archived @done Tasks to a Markdown Log File with tastic’s Archive Command

To move completed tasks found in the Archive project of a taskpaper document into an adjacent markdown file run the command:

tastic archive ~/Desktop/saturday-tasks.taskpaper

As you see the Archived project has been removed from the saturday-tasks.taskpaper document. But don’t worry, the completed tasks are not gone, they’ve just been moved to a markdown file located at ~/Desktop/saturday-tasks-tasklog.md and formats them into a neat, complete-date ordered table1.

task completed project
research the price of fencing online 2016–09–15 tidy the garden / replace hedge with fence
clear the garden 2016–09–15 tidy the garden / cut the grass

Again if you want to run this code on all taskpaper documents contained within a workspace, pass instead the root-path of the workspace:

tastic archive /path/to/my/workspace/

I’ve a couple of other features I want to add tastic, so keep an eye on my posts over the next days if you’re interested.


  1. completed date only added if @done tags includes the completion date as an attribute, e.g. @done(2016-11-09)  ↩