Commit 5c0c2d00 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Print todo identifiers with delete or do subcommands.

When the linenumber based todos are used, you still risk the wrong
ID is printed. But now you can used a UID to reduce the chance
significantly.
parent 590f0e74
...@@ -78,7 +78,7 @@ class DeleteCommandTest(CommandTest.CommandTest): ...@@ -78,7 +78,7 @@ class DeleteCommandTest(CommandTest.CommandTest):
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.is_dirty())
self.assertEquals(self.todolist.todo(1).source(), "Foo") self.assertEquals(self.todolist.todo(1).source(), "Foo")
self.assertEquals(self.output, "Removed: Bar p:1\nThe following todo item(s) became active:\nFoo\n") self.assertEquals(self.output, "Removed: Bar p:1\nThe following todo item(s) became active:\n| 1| Foo\n")
self.assertEquals(self.errors, "") self.assertEquals(self.errors, "")
def test_del7(self): def test_del7(self):
......
...@@ -167,7 +167,7 @@ class DoCommandTest(CommandTest.CommandTest): ...@@ -167,7 +167,7 @@ class DoCommandTest(CommandTest.CommandTest):
command = DoCommand.DoCommand(["3"], self.todolist, self.out, self.error) command = DoCommand.DoCommand(["3"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertEquals(self.output, first_output + "Completed: x %s Baz p:1\nThe following todo item(s) became active:\nFoo id:1\n" % self.today) self.assertEquals(self.output, first_output + "Completed: x %s Baz p:1\nThe following todo item(s) became active:\n| 1| Foo id:1\n" % self.today)
self.assertEquals(self.errors, "") self.assertEquals(self.errors, "")
def test_activated_todos2(self): def test_activated_todos2(self):
......
...@@ -63,12 +63,8 @@ class DCommand(Command): ...@@ -63,12 +63,8 @@ class DCommand(Command):
def _uncompleted_children(self, p_todo): def _uncompleted_children(self, p_todo):
return sorted([t for t in self.todolist.children(p_todo) if not t.is_completed()]) return sorted([t for t in self.todolist.children(p_todo) if not t.is_completed()])
def _print_list(self, p_todos, p_print_numbers=True): def _print_list(self, p_todos):
filters = []
if p_print_numbers:
filters = [self.todolist.pp_number()] filters = [self.todolist.pp_number()]
self.out("\n".join(pretty_print_list(p_todos, filters))) self.out("\n".join(pretty_print_list(p_todos, filters)))
def prompt_text(self): def prompt_text(self):
...@@ -95,7 +91,7 @@ class DCommand(Command): ...@@ -95,7 +91,7 @@ class DCommand(Command):
delta = [todo for todo in p_new if todo not in p_old] delta = [todo for todo in p_new if todo not in p_old]
if delta: if delta:
self.out("The following todo item(s) became active:") self.out("The following todo item(s) became active:")
self._print_list(delta, False) self._print_list(delta)
def _active_todos(self): def _active_todos(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