Commit d8e76bc0 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Make a GrepFilter for every argument passed to the ListCommand.

This ANDs all arguments, resulting in the todos that match all
substrings.
parent cb03c8db
...@@ -54,8 +54,8 @@ class ListCommand(Command.Command): ...@@ -54,8 +54,8 @@ class ListCommand(Command.Command):
sorter = Sorter.Sorter(self.sort_expression) sorter = Sorter.Sorter(self.sort_expression)
filters = [] if self.show_all else [Filter.DependencyFilter(self.todolist), Filter.RelevanceFilter()] filters = [] if self.show_all else [Filter.DependencyFilter(self.todolist), Filter.RelevanceFilter()]
if len(args) > 0: for arg in args:
filters.append(Filter.GrepFilter(args[0])) filters.append(Filter.GrepFilter(arg))
filters.append(Filter.LimitFilter(Config.LIST_LIMIT)) filters.append(Filter.LimitFilter(Config.LIST_LIMIT))
......
...@@ -78,6 +78,14 @@ class ListCommandTest(CommandTest.CommandTest): ...@@ -78,6 +78,14 @@ class ListCommandTest(CommandTest.CommandTest):
self.assertEquals(self.output, "") self.assertEquals(self.output, "")
self.assertEquals(self.errors, "") self.assertEquals(self.errors, "")
def test_list9(self):
command = ListCommand.ListCommand(["text1", "2"], self.todolist, self.out, self.errors)
command.execute()
self.assertFalse(self.todolist.is_dirty())
self.assertEquals(self.output, " 2 (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()
......
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