Commit 28532694 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Print todo text when removing it.

parent e6d6cbe7
...@@ -33,7 +33,7 @@ class DeleteCommandTest(CommandTest.CommandTest): ...@@ -33,7 +33,7 @@ class DeleteCommandTest(CommandTest.CommandTest):
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.is_dirty())
self.assertEquals(self.todolist.todo(1).source(), "Bar") self.assertEquals(self.todolist.todo(1).source(), "Bar")
self.assertEquals(self.output, "Todo 1 removed.\n") self.assertEquals(self.output, " 1 Foo id:1\nRemoved.\n")
self.assertEquals(self.errors, "") self.assertEquals(self.errors, "")
def test_del2(self): def test_del2(self):
...@@ -42,7 +42,7 @@ class DeleteCommandTest(CommandTest.CommandTest): ...@@ -42,7 +42,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, "Todo 2 removed.\n") self.assertEquals(self.output, " 2 Bar p:1\nRemoved.\n")
self.assertEquals(self.errors, "") self.assertEquals(self.errors, "")
def test_del3(self): def test_del3(self):
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from Command import * from Command import *
from PrettyPrinter import pretty_print
from TodoList import InvalidTodoException from TodoList import InvalidTodoException
from Utils import convert_todo_number, InvalidTodoNumberException from Utils import convert_todo_number, InvalidTodoNumberException
...@@ -40,8 +41,9 @@ class DeleteCommand(Command): ...@@ -40,8 +41,9 @@ class DeleteCommand(Command):
if not self.number: if not self.number:
self.error(self.usage()) self.error(self.usage())
elif self.todo: elif self.todo:
self.out(pretty_print(self.todo, [self.todolist.pp_number()]))
self.todolist.delete(self.todo) self.todolist.delete(self.todo)
self.out("Todo %d removed." % self.number) self.out("Removed.")
else: else:
self.error("Invalid todo number given.") self.error("Invalid todo number given.")
......
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