mirror of
https://github.com/topydo/topydo.git
synced 2024-06-03 02:48:34 +00:00
Introduce 'before' and 'after' keywords to dep ls
From now on: `topydo dep ls before 1` gives the same output as `topydo dep ls 1 to` and: `topydo dep ls after 1` gives the same output as `topydo dep ls to 1`
This commit is contained in:
parent
edc11eeb28
commit
77abb6c022
|
@ -271,6 +271,42 @@ class DepCommandTest(CommandTest):
|
|||
self.assertEqual(self.errors, "Invalid todo number given.\n")
|
||||
|
||||
def test_ls5(self):
|
||||
command = DepCommand(["ls", "before", "1"], self.todolist, self.out,
|
||||
self.error)
|
||||
command.execute()
|
||||
|
||||
self.assertFalse(self.todolist.dirty)
|
||||
self.assertEqual(self.output, "| 2| Bar p:1\n| 3| Baz p:1\n")
|
||||
self.assertEqual(self.errors, "")
|
||||
|
||||
def test_ls6(self):
|
||||
command = DepCommand(["ls", "before", "99"], self.todolist, self.out,
|
||||
self.error)
|
||||
command.execute()
|
||||
|
||||
self.assertFalse(self.todolist.dirty)
|
||||
self.assertEqual(self.output, "")
|
||||
self.assertEqual(self.errors, "Invalid todo number given.\n")
|
||||
|
||||
def test_ls7(self):
|
||||
command = DepCommand(["ls", "after", "3"], self.todolist, self.out,
|
||||
self.error)
|
||||
command.execute()
|
||||
|
||||
self.assertFalse(self.todolist.dirty)
|
||||
self.assertEqual(self.output, "| 1| Foo id:1\n")
|
||||
self.assertEqual(self.errors, "")
|
||||
|
||||
def test_ls8(self):
|
||||
command = DepCommand(["ls", "after", "99"], self.todolist, self.out,
|
||||
self.error)
|
||||
command.execute()
|
||||
|
||||
self.assertFalse(self.todolist.dirty)
|
||||
self.assertEqual(self.output, "")
|
||||
self.assertEqual(self.errors, "Invalid todo number given.\n")
|
||||
|
||||
def test_ls9(self):
|
||||
command = DepCommand(["ls", "1"], self.todolist, self.out, self.error)
|
||||
command.execute()
|
||||
|
||||
|
@ -278,7 +314,7 @@ class DepCommandTest(CommandTest):
|
|||
self.assertEqual(self.output, "")
|
||||
self.assertEqual(self.errors, command.usage() + "\n")
|
||||
|
||||
def test_ls6(self):
|
||||
def test_ls10(self):
|
||||
command = DepCommand(["ls"], self.todolist, self.out, self.error)
|
||||
command.execute()
|
||||
|
||||
|
@ -286,7 +322,7 @@ class DepCommandTest(CommandTest):
|
|||
self.assertFalse(self.output)
|
||||
self.assertEqual(self.errors, command.usage() + "\n")
|
||||
|
||||
def test_ls7(self):
|
||||
def test_ls11(self):
|
||||
command = DepCommand(["ls", "top", "99"], self.todolist, self.out,
|
||||
self.error)
|
||||
command.execute()
|
||||
|
|
|
@ -108,13 +108,13 @@ class DepCommand(Command):
|
|||
arg2 = self.argument(2)
|
||||
|
||||
todos = []
|
||||
if arg2 == 'to':
|
||||
# dep ls 1 to ...
|
||||
number = arg1
|
||||
if arg2 == 'to' or arg1 == 'before':
|
||||
# dep ls 1 to OR dep ls before 1
|
||||
number = arg1 if arg2 == 'to' else arg2
|
||||
todo = self.todolist.todo(number)
|
||||
todos = self.todolist.children(todo)
|
||||
elif arg1 == 'to':
|
||||
# dep ls ... to 1
|
||||
elif arg1 in {'to', 'after'}:
|
||||
# dep ls to 1 OR dep ls after 1
|
||||
number = arg2
|
||||
todo = self.todolist.todo(number)
|
||||
todos = self.todolist.parents(todo)
|
||||
|
@ -176,6 +176,7 @@ class DepCommand(Command):
|
|||
dep add <NUMBER> <before|partof|after|parents-of|children-of> <NUMBER>
|
||||
dep ls <NUMBER> to
|
||||
dep ls to <NUMBER>
|
||||
dep ls <before|after> <NUMBER>
|
||||
dep dot <NUMBER>
|
||||
dep clean"""
|
||||
|
||||
|
|
Loading…
Reference in a new issue