Remember the Milk CLI
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!
Features
Version 1.3.0
This version includes a number of improvements and new features, including:
- Support for Python 3 (the script still works with Python 2.6 and 2.7)
- Added readline support - now you can scroll through command history in interactive mode
- Added a function to edit task names (
rtm edit [index] [new name]) - Added a function to edit note title and text (
rtm editNote [task index]) - Improved planner display (it can now be displayed with color and will fit to the width of the console)
- Improved the display of notes (long lines will wrap based on console width)
If you need unicode support, please read this note on potential conflicts with unicode.
Older Versions...
Version 1.2.0
Version 1.2.0 adds the ability to add and delete notes to and from tasks. Use rtm addNote/an [task index] [note title] [note body] to add a note to the specified
task and delNote/dn [task index] to delete one or more notes from the specified task - the script will display the title of each note and ask if you want that particular
note to be deleted.
Version 1.1.4
Version 1.1.4 includes a couple of bug fixes including the TypeError: %d format: a number is required, not NoneType when displaying filtered tasks
and should now display the most recent occurence of a recurring task when displaying an unfiltered list.
Version 1.1.3
Version 1.1.3 should hopefully fix the AttributeError: 'list' object has no attribute 'id' bug. Let me know if you're still experiencing this problem.
Version 1.1.2
Version 1.1.2 can now properly display the bodies of notes.
Version 1.1.1
Version 1.1.1 adds a new interactive mode. This allows multiple commands to be entered at a prompt and since the script only has to authenticate once, commands (particularly displaying tasks) are issued much quicker. Unicode support has also been added (the script should no longer quit when trying to display a unicode character).
Version 1.0.1
Version 1.0.* has the same features as 0.9.1 (Known Bug: The bodies of notes are not displayed when using Fixed in Version 1.1.2).
This update fixes the "Error: 111: format 'rest' not found" problem
that was occurring very frequently - if not all the time. This version no longer uses rtmapi and has been rewritten to use
the pyrtm API interface. So, if you are updating the script from any version
before 1.0.0, you will have to download both the updated script and pyrtm.
rtm notes
Version 0.9.1
The following Remember the Milk functions were added:
- Adding lists
- Deleting lists
- Renaming lists
- Displaying task tags
- Adding task tags
- Removing task tags
- Viewing task notes
- Logging out (ie removing stored login credentials used by RTM-CLI)
- Minor speed improvement when listing tasks
- Ability to toggle the display of tags, notes indicator and completed tasks
- Ability to filter tasks displayed in the planner (when a filter is used the start date argument must be passed)
I've also added a function to delete all completed tasks (or those matching a specified filter) and the ability to undo all actions that were performed as a group.
Version 0.9.0
The following Remember the Milk functions are currently supported:
- Adding tasks
- Completing tasks
- Deleting tasks
- Assigning / changing task due dates
- Listing tasks sorted by 1) List 2) Due Date or 3) Priority
- Moving tasks to a different list
- Postponing the due dates of tasks
- Assigning / changing the priorities of tasks
- Uncompleting tasks
In addition, I've added the ability to undo the last action performed by the RTM-CLI and a weekly planner which displays a week-long calendar of all tasks (sorted by list and priority) due within the current week.
Download
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:
RTM-CLI (The script)
Download Latest Version: from bitbucket.org
Download Old Versions:
- More recent older versions can be found on bitbucket.org
- version 1.0.1
- version 1.0.0
- version 0.9.1
- version 0.9.0
pyrtm (The API Interface)
Download: pyrtm source
The script has been tested and works well with version 0.3 of pyrtm.
Unicode Support Information:
Unicode is not working when the script is used in conjuction with version 0.4.1 of pyrtm (the rtm api module) and Python 2. If you need unicode support, the following configurations of Python and pyrtm seem to work:- Using Python 2.6 or 2.7: use pyrtm version 0.3. NOTE: with readline enabled, you may not be able to enter unicode characters in interactive mode. You can
disable readline by using the
-rflag or disabling readline by setting theENABLE_READLINEvariable to 0 in the top of the script. - Using Python 3: full unicode support is working with pyrtm version 0.4.1 (the latest at time of testing). Unicode characters can also be entered when readline is enabled.
- Using Python 2.6 or 2.7: use pyrtm version 0.3. NOTE: with readline enabled, you may not be able to enter unicode characters in interactive mode. You can
disable readline by using the
Installation
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.
Usage
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:
Errands:
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
Work:
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>
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 | | | | | |
+----------------------+-----------------+--------------------+--------------------+---------------+---------------+---------------+
OVERDUE TASKS:
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:
USAGE
rtm [options] ... [command] [command arguments]
Options:
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>
priority:<priority>
tag:<tag>
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
Meta-Commands:
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
A few users have reported an error when attempting to list the tasks: 'list' object has no attribute 'id'. If you're receiving this error please see this issueThe bodies of notes are not displayed usingrtm notesInitial authentication may failTask lists cannot be modified- The following features have not been tested (may or may not work as expected):
Tagstags are not displayed but can be used to filter displayed tasks
rtm ls tag:<tag name>Notesnotes are not displayed and cannot be modified.- Locations
- Expected Durations
- Recurring tasks
When a recurring task is completed, the task 'disappears' and the next occurence will appear on the task list
Todo
Add an interactive modeAdd support for unicode textImprove Speed- Offline Support
- Add support for missing RTM features
- Possibly add support for displaying Google Calendar events along with tasks (using Google's new GoogleCL python scripts for Google Calendar)
Suggestions are more than welcome!
License
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.