Commit f0c4d9a9 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Show usage when no subsubcommand was given.

parent 359ddb9a
......@@ -28,7 +28,11 @@ class DepCommand(Command):
p_err=lambda a: None,
p_prompt=lambda a: None):
super(DepCommand, self).__init__(p_args, p_todolist, p_out, p_err, p_prompt)
self.subsubcommand = self.argument(0)
try:
self.subsubcommand = self.argument(0)
except InvalidCommandArgument:
self.subsubcommand = None
def _handle_add(self):
(from_todo, to_todo) = self._get_todos()
......
......@@ -194,3 +194,11 @@ class DepCommandTest(CommandTest.CommandTest):
self.assertEqual(self.errors, command.usage() + "\n")
self.assertFalse(self.todolist.is_dirty())
def test_no_subsubcommand(self):
command = DepCommand.DepCommand([], self.todolist, self.out, self.error)
command.execute()
self.assertFalse(self.output)
self.assertEqual(self.errors, command.usage() + "\n")
self.assertFalse(self.todolist.is_dirty())
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