Remember the Milk Blog

Featured app: RTM-CLI
Friday, October 5, 2012 by Brendan Ganley

For some people, the command line is a scary place reserved only for the most dire emergencies. For others, it's the quickest and easiest way to do just about everything. If you fall into the second category, take a look at David Waring's RTM-CLI script. If you're a serious command line enthusiast looking to manage your Remember The Milk tasks, this script is a must-have.

Read More

Remember the Milk is a superb and popular task-management web-app. It has a lot of great features and excellent integration with some third-party services (such as Gmail and Google Calendar, Twitter, IM, SMS and smartphone apps). However, I wanted an easy to use command line program that would make displaying and managing my task list even that much quicker and easier. This project aims at creating a full python-based command-line interface for Remember the Milk using the official API.

This project uses the pyrtm python interface for the Remember the Milk API by Sridhar Ratnakumar. If you are updating the script from anything earlier than version 1.0.0 (which used rtmapi), make sure you download and install pyrtm.

NOTE: This project is now hosted on bitbucket. If you're interested in collaborating or contributing bug fixes or new features, let me know!

Call for Suggestions

I would like to improve the way recurring tasks are handled and displayed by the script. However, I don't really use recurring tasks all that often so I'm not quite sure of the best way to handle them. That's why I'm asking all of you out there to offer up some suggestions on how you would like to see recurring tasks handled. Feel free to leave a comment on the website or send me an email with your ideas. Thanks!


Version 1.3.0

This version includes a number of improvements and new features, including:

If you need unicode support, please read this note on potential conflicts with unicode.

Older Versions...


In addition to Python 2.6 or greater (including Python 3 starting with version 1.3.0 of the script), you will need to download and install two components in order to run the RTM-CLI:


You'll need Python version 2.6 or later (including Python 3 starting with version 1.3.0 of the script). Please see this note on unicode support if you need unicode support on Python 2. Visit python.org for more information and to download the latest release.

First, install pyrtm by downloading the source code and unpacking the archive. From the pyrtm directory, install the pyrtm module by using the command:

sudo python setup.py install

Then, copy the rtm script to somewhere in your $PATH such as /usr/local/bin/. Finally, make the script executable using the chmod command:

sudo chmod +x rtm

To grant the program access to your RTM account, run any command (such as rtm ls) and a browser window will open the RTM website. Just login with the account you wish to use and allow "RTM CLI" access to your account.

NOTE: You may receive an error stating that Login failed / Invalid auth token. However, the program will function correctly despite this (the first command just needs to be called again). This could be a bug in the rtmapi or a problem in the way I am implementing it. But it's only a problem when first granting RTM access to the program.
With version 1.0.0, this no longer seems to be a problem.

That's it! Now check out rtm --help for supported commands.


rtm ls screenshot The script's usage is fairly straight forward. Just use rtm followed by a single command. When applying a function to a particular task you need to reference the task by its index number - which is the number to the left of each task (see labeled screenshot on right). When referencing lists or tags, use thier names (case-sensitive).

Filters, used when displaying tasks or clearing completed tasks, use RTM's advanced search syntax.

Interactive Mode: Use rtm without any commands to start the interactive mode. Here multiple commands can be given and since the script only has to authenticate with RTM once (rahter than before each command), the response is much quicker.

Listing Tasks

The task properties that are displayed include its priority, name, an indicator of any associated notes (the number of * symbols indicates the number of notes that are associated with the task), any tags (displayed with the # symbol), the task's due date if its incomplete or the completed date for completed tasks. To toggle the display of completed tasks, note indicators or tags use the -c, -n or -t flags, respectively (all are displayed by default, but this can be changed by changing the associated variables in the beginning of the rtm script).

To display all tasks divided into their lists and then sorted by priority use:

rtm ls
which will display:

03 (1) Overdue task | Fri 10-12
01 (1) Buy Milk #groceries #urgent | Sun 10-14
06 (2) Update RTM tasks | Sun 10-14
08 (3) Do Laundry | Mon 10-15
02     Due anytime
05     Has two notes**
04     Buy Müsli #groceries | Tue 10-16
07  x  Wash Car x Sun 10-14

15 (1) Quit job #urgent | Sun 10-14
16 (1) High Priority | Mon 10-15
17 (2) Has one note* | Mon 10-15
09 (2) Medium Priority | Tue 10-16
10 (3) Low Priority | Wed 10-17
13     No Priority #tag1 #tag2 #tag3
11  x  completed task x Sun 10-14
14  x  completed task with note x Sun 10-14
12  x  completed task with tag #tag1 x Sun 10-14

In order to display tasks divided by their due dates (task items with no due date will be grouped at the top) and then sorted by priority, use:

rtm lsd

02     Errands: Due anytime
05     Errands: Has two notes**
13     Work: No Priority #tag1 #tag2 #tag3

   Fri 10-12
03 (1) Errands: Overdue task

   Sun 10-14
01 (1) Errands: Buy Milk #groceries #urgent
15 (1) Work: Quit job #urgent
06 (2) Errands: Update RTM tasks
11  x  Work: completed task x Sun 10-14

   Mon 10-15
16 (1) Work: High Priority
17 (2) Work: Has one note*
08 (3) Errands: Do Laundry
14  x  Work: completed task with note x Sun 10-14
07  x  Errands: Wash Car x Sun 10-14

   Tue 10-16
09 (2) Work: Medium Priority
04     Errands: Buy Müsli #groceries
12  x  Work: completed task with tag #tag1 x Sun 10-14

   Wed 10-17
10 (3) Work: Low Priority

The command

rtm lsp
will display tasks sorted first by priority and then by list name:

03 (1) Errands: Overdue task | Fri 10-12
01 (1) Errands: Buy Milk #groceries #urgent | Sun 10-14
15 (1) Work: Quit job #urgent | Sun 10-14
16 (1) Work: High Priority | Mon 10-15
06 (2) Errands: Update RTM tasks | Sun 10-14
17 (2) Work: Has one note* | Mon 10-15
09 (2) Work: Medium Priority | Tue 10-16
08 (3) Errands: Do Laundry | Mon 10-15
10 (3) Work: Low Priority | Wed 10-17
02     Errands: Due anytime
05     Errands: Has two notes**
04     Errands: Buy Müsli #groceries | Tue 10-16
13     Work: No Priority #tag1 #tag2 #tag3
11  x  Work: completed task x Sun 10-14
14  x  Work: completed task with note x Sun 10-14
12  x  Work: completed task with tag #tag1 x Sun 10-14
07  x  Errands: Wash Car x Sun 10-14

When displaying tasks using the above three methods, any tasks that have a note associated with them will have an asterisk for each note after the task's name. In the above examples, task 5 has 2 notes associated with it. To display the notes, use the command:

rtm notes 5

which will display the two associated notes:

|       Second Note       |
| Here is the body of the |
| second note.            |

|          Note title          |
| This is the body of the note |
| It can contain               |
|                              |
| multiple lines.              |

To display a weekly planner, use:

rtm planner <start> <filter>

rtm planner screenshot

where <start> specifies the start day for the week and can be either sun, mon (default) or today and <filter> is a filter string following RTM's advanced search rules. Tasks without any due date or were due before the first day of the planner will be shown below the planner. As of right now, tags and note indicators are not displayed.

The width of the planner will fit the width of your console window, clipping the names of tasks that are too long to fit in the space provided for a specific day.

|      Sun 10-14       |    **TODAY**    |     Tue 10-16      |     Wed 10-17      |   Thu 10-18   |   Fri 10-19   |   Sat 10-20   |
| Errands:             | Errands:        | Errands:           | Errands:           | Errands:      | Errands:      | Errands:      |
|   (1) Buy Milk       |   (3) Do Laundr |       Buy Müsli    |                    |               |               |               |
|   (2) Update RTM tas |    x  Wash Car  |                    |                    |               |               |               |
| Work:                | Work:           | Work:              | Work:              | Work:         | Work:         | Work:         |
|   (1) Quit job       |   (1) High Prio |   (2) Medium Prior |   (3) Low Priority |               |               |               |
|    x  completed task |   (2) Has one n |    x  completed ta |                    |               |               |               |
|                      |    x  completed |                    |                    |               |               |               |

  Errands:  (1) Overdue task

Due Anytime:
  Errands:      Due anytime        Has two notes
  Work:         No Priority

Modifying tasks

Single tasks can be modified by specifying its task index number after the command. When no task index is given, the user will be able to enter multiple tasks and arguments at a prompt. For example, to mark task #15 as complete, the command is:

rtm comp 15

while rtm comp (note the missing task index) will bring up a prompt to enter multiple tasks to mark as complete.

New tasks are added using the following format:

task name due date p:priority l:list t:tag t:tag

For example, to add a task to pick up the dry cleaning on Thursday with a priority of 2 to the list named Errands with an urgent tag, the command would be:

rtm add pick up dry cleaning Thurs p:2 l:Errands t:urgent

Task names can now be edited / changed using the rtm edit [index] [new name] command.

Task notes can now be added and modified using the script. To add a new note to a task use the rtm addNote [index] [title] [body] syntax (or just rtm addNote to add multiple notes. To edit a note (both tile and body), use the rtm editNote [index]. This will prompt you the title(s) of each note for the specified task, allowing you to edit each one in turn. The bodies of the notes are edited using the nano (by default) text editor. The specific CLI text editor can be changed in the top of the script.

All commands

See rtm --usage for all currently supported functions:

  rtm [options] ... [command] [command arguments]

    Note: To change the default display variables, edit the values in the beginning of this script

    --comp, -c          : toggle the display of completed tasks - default 1
    --help, -h          : display the help and usage
    --notes, -n         : toggle the display of notes indicators - default 1
    --plain, -p         : set output to plain (no color) - default 0
    --readline, -r      : toggle readline support (disable to improve unicode support in interative mode) - default 1
    --status, -s        : toggle the display of status messages - default 1
    --tags, -t          : toggle the display of tags - default 1
    --usage, -u         : display the usage
    --version, -v       : display the author and version

  Commands [arguments]:
    - Only 1 command can be used at a time
    - Leaving the command blank will start the interactive mode
    - Generally, leaving the arguments blank will allow the user to enter
      multiple arguments at a prompt (ie marking multiple tasks complete).

    add [task]          : add a task using the following format::
      a [task]              task name due date p:priority l:list name t:tag
    addList [name]      : add a new list to RTM using the specified name
      al [name]
    addNote [index] [title] [body] : add a note to the specified task
      an [index] [title] [body]
    addTags [index] [tags] : add the given tags to the specified task
      at [index] [tags]
    comp [index]        : mark the task specified by its index number as complete
      c [index]
    delete [index]      : delete the task specified by its index number
      del [index]
      rm [index]
    delList [name]      : delete the list specified by its name
      dl [name]             (moves remaining tasks to the Inbox)
    delNote [index]     : delete a note from the specified task
      dn [index]
    delTags [index] [tags] : delete the given tags from the specified task
      dt [index] [tags]
    due [index] [date]  : set the due date of the task specified by its index number
    edit [index] [name] : edit the name of the task specified by its index number
      e [index] [name]
    editNote [index]    : edit one of the notes for the specified task
      en [index]
    exit                : exit interactive mode
    help                : display this help information
    logout              : remove login credentials used by RTM-CLI
    ls [filter]         : list all tasks sorted first by list then priority
    lsd [filter]        : list all tasks sorted first by due date then priority
    lsp [filter]        : list all tasks sorted first by priority then list
        [filter]        : filter options based on RTM's advanced search filters, ie::
                            list:<task list>
                            status:<completed | incomplete>
                            due:<due date>
    move [index] [list] : move the task specified by its index number to the specified list
      mv [index] [list]
      m [index] [list]
    notes [index]       : display the notes for the task specified by its index number
    open [page]         : open RTM <page> (home by default) in a web browser
      o [page]              <page> = filters, help, home, planner, tasks, search, settings
    postpone [index]    : postpone the due date of the specified task by 1 day
      pp [index]
    pri [index] [pri]   : set the priority of task specified by its index number to <pri>,
      p [index] [pri]       where <pri> can be priorities 1,2,3 or 0 to remove priority
    renameList [old name] [new name] : change the name of a list from <old name> to <new name>
      mvList [old name] [new name]
    uncomp [index]      : uncomplete the task specified by its index number
      unc [index]           set the status of a previously completed task to incomplete
      inc [index]
    undo                : undo the last function

    clear [filter]      : delete all completed tasks (that match the optional filter)
    planner [start] [filter] : print a weekly planner for tasks with due dates for this week
      week [start] [filter]      <start> = mon (default), sun or today
                               NOTE: this will print a very wide display and task names will
                                  be cut at 20 characters.
    today               : display prioritized tasks and tasks completed today

Known Bugs & Limitations


Suggestions are more than welcome!


This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.


blog comments powered by Disqus