Commit 241aa3e9 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Let ListCommand print UIDs.

parent d7ff4f48
...@@ -145,6 +145,16 @@ class ListCommandTest(CommandTest.CommandTest): ...@@ -145,6 +145,16 @@ class ListCommandTest(CommandTest.CommandTest):
self.assertEquals(self.output, " 2 (D) Bar @Context1 +Project2 p:1\n") self.assertEquals(self.output, " 2 (D) Bar @Context1 +Project2 p:1\n")
self.assertEquals(self.errors, "") self.assertEquals(self.errors, "")
def test_list16(self):
config("data/todolist-uid.conf")
command = ListCommand.ListCommand([], self.todolist, self.out, self.error)
command.execute()
self.assertFalse(self.todolist.is_dirty())
self.assertEquals(self.output, "6iu (C) Foo @Context2 Not@Context +Project1 Not+Project\ntil (C) Drink beer @ home\n c5 (C) 13 + 29 = 42\nxvb (D) Bar @Context1 +Project2 p:1\n")
self.assertEquals(self.errors, "")
def test_help(self): def test_help(self):
command = ListCommand.ListCommand(["help"], self.todolist, self.out, self.error) command = ListCommand.ListCommand(["help"], self.todolist, self.out, self.error)
command.execute() command.execute()
......
...@@ -200,6 +200,9 @@ class TodoListBase(object): ...@@ -200,6 +200,9 @@ class TodoListBase(object):
A filter for the pretty printer to append the todo number to the A filter for the pretty printer to append the todo number to the
printed todo. printed todo.
""" """
if config().identifiers() == 'text':
return lambda p_todo_str, p_todo: "%3s %s" % (self._todo_id_map[p_todo], p_todo_str)
else:
return lambda p_todo_str, p_todo: "%3d %s" % (self.number(p_todo), p_todo_str) return lambda p_todo_str, p_todo: "%3d %s" % (self.number(p_todo), p_todo_str)
def _update_todo_ids(self): def _update_todo_ids(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment