DEV Community

loading...
Cover image for ✔ Tasks and To Dos My Plain Text Journey Part VI

✔ Tasks and To Dos My Plain Text Journey Part VI

Ryan Collins
Just a geek developing through life.
Originally published at gozgeek.com on ・3 min read

I believe that there are as many ways to manages tasks as there are stars in the sky. Through the years I have tested several different methods, and my current methods rely on two plain text formats for tasks: Taskpaper and todo.txt.

.taskpaper format

I started with the Taskpaper format, keeping my todo list in a file named today.taskpaper. The Taskpaper format is pretty simple. Projects are on a line by themselves and end with a :. Tasks are on their own lines, and start with a -. Here’s a sample file:

Errands:
- Check out that car
- Drop off packages

Grocery:
- Milk
- Eggs
- Diet Mountain Dew
- Ho Hos

Enter fullscreen mode Exit fullscreen mode

To set priorities, contexts, start dates, due dates, etc. you use the @ in front of whatever word you want to use. For example, @due(2021-12-24) would be a due date for a task, and @start(2021-11-30) could be a start date. The @ words used are up to you, and you can use whatever you want. To complete a task, you add @done(YYYY-MM-DD) to the task line.

Taskpaper is great for outlining, but it is a pain to parse in scripts. Because of this, I currently use todo.txt for my daily to do list, while .taskpaper files are used for specific projects.

todo.txt

todo.txt lists each task as itself on a line. No prefix necessary. Projects are added to a task with +PROJECTNAME and contexts use @CONTEXT. For example:

Get milk +grocery @errands
Check out that car @errands
Ho Hos +grocery @errands
Diet Mountain Dew +grocery @errands

Enter fullscreen mode Exit fullscreen mode

Priorities are prepended to the line, and they go from A-Z. I have no idea why you would use all of them, but hey, you be you. The priority goes in parenthesis at the beginning of the line: (A) Ho Hos +grocery @errands. Extra information that you may want to put with a task can be added as a key:value pair, such as due dates (due:2021-12-24) or threshold (start) date (t:2021-11-30).

To mark a task done, you prepend an x to the beginning of the line. You can also add done:YYYY-MM-DD to the line to record the date completed.

The todo.txt format is pretty easy to parse, and has a wide ecosystem of scripts and programs behind it.

Working with the lists

The lists are all stored in the same Git repo as my plain-text notes, using a folder named Lists. To work with the lists at the command line, I use the todo.txt bash script for the todo.txt file. For the .taskpaper files I use Vim and the Taskpaper plugin. If you were working from the GUI, there are plugins for VS Code or several different apps to use.

Notifications

When I have due dates I do like to get a notification at the start of the day. I wrote a bash script that goes through my todo.txt file and looks for tasks with a due dates of today. The script runs at midnight. The script adds a priority of (A) for tasks due today, and then it sends me a list of tasks that have a priority set.

#!/bin/bash

nl=$'\n'

#TelegramBot
# .telegraminfo has the bot API key and my Telegram chat ID
source ~/.telegraminfo.cfg

#Where are the tasks
TASKS="${HOME}/notes/Lists/todo.txt"
temp="/tmp/temp.todo.txt"

# Delete the temp file if it exists
[-f ${temp}] && rm "${temp}"

# Loop through the file and look for tasks due today
# Set the priority to (A)
while read i || [[-n $i]]; do
    if [[${i} =~ "due:${TODAY}"]]; then
        echo "(A) ${i}" >> "${temp}" 
    else 
        echo "${i}" >> ${temp}
    fi
done < "${TASKS}"
mv "${temp}" "${TASKS}"

#Message what is due today
DUE=""

# Anything with a priority set will be sent
while read i || [[-n $i]]; do
    if [[${i} =~ ^\(.\)\]]; then
        DUE+="${i}${nl}"
    fi
done < ${TASKS}

# Send to Telegram

read -r -d '' MSG <<EOT
Tasks due ${TODAY}:
${DUE}
EOT

/usr/bin/curl -s -X POST \
https://api.telegram.org/bot${APIKEY}/sendMessage \
-d text="${MSG}" \
-d parse_mode="Markdown" \
-d chat_id=${TO} > /dev/null

Enter fullscreen mode Exit fullscreen mode

It works for me, but…

I like how I have it set up now, but I feel like there is still room for improvement. Maybe when I find some time…

Discussion (0)