ui.cli: Repeat the basic help when the user calls `help`
authorW. Trevor King <wking@tremily.us>
Wed, 6 Feb 2013 20:01:17 +0000 (15:01 -0500)
committerW. Trevor King <wking@tremily.us>
Wed, 6 Feb 2013 20:04:12 +0000 (15:04 -0500)
quizzer/ui/cli.py

index 5938f5505599e7f748180967bc0c3dcffe7c3ebd..1740e001628d4d5a3eff56e888b136cdf4bc0239 100644 (file)
@@ -88,6 +88,12 @@ class QuestionCommandLine (_cmd.Cmd):
         self._reset()
         print(self.question.format_help())
 
+    def do_help(self, arg):
+        'List available commands with "help" or detailed help with "help cmd"'
+        if not arg:
+            print('\n'.join(self._help))
+        super(QuestionCommandLine, self).do_help(arg)
+
 
 class CommandLineInterface (UserInterface):
     def run(self):