Commit 5122ef03 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Merge pull request #123 from MinchinWeb/fix-121

Allow using `tag -a` multiple times
parents 4b8c8f09 c0eec59d
...@@ -75,6 +75,17 @@ class TagCommandTest(CommandTest): ...@@ -75,6 +75,17 @@ class TagCommandTest(CommandTest):
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, "Invalid todo number.\n") self.assertEqual(self.errors, "Invalid todo number.\n")
def test_force_add_tag01(self):
'''Tries to different values to a tag for the same name 3 times.'''
for letter in ['a', 'b', 'c']:
command = TagCommand(['-a', '1', 'k', letter], self.todolist,
self.out, self.error)
command.execute()
self.assertEqual(self.errors, "")
self.assertTrue(self.todolist.is_dirty())
self.assertEqual(self.todolist.todo(1).source(), "Foo k:a k:b k:c")
def test_set_tag04(self): def test_set_tag04(self):
command = TagCommand(["3", "due", "2014-10-20"], self.todolist, command = TagCommand(["3", "due", "2014-10-20"], self.todolist,
self.out, self.error) self.out, self.error)
......
...@@ -109,7 +109,7 @@ class TagCommand(Command): ...@@ -109,7 +109,7 @@ class TagCommand(Command):
self.todolist.set_dirty() self.todolist.set_dirty()
def _set(self): def _set(self):
if len(self.current_values) > 1: if len(self.current_values) > 1 and not self.force_add:
answer = self._choose() answer = self._choose()
if answer == "all": if answer == "all":
......
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