ui.cli: Add an `answer` command to QuestionCommandLine
authorW. Trevor King <wking@tremily.us>
Wed, 6 Feb 2013 20:09:20 +0000 (15:09 -0500)
committerW. Trevor King <wking@tremily.us>
Wed, 6 Feb 2013 20:09:20 +0000 (15:09 -0500)
This allows you to bypass quizzer-shell command handling when your
answer line starts with a quizzer-shell command.

quizzer/ui/cli.py

index 1740e001628d4d5a3eff56e888b136cdf4bc0239..fbebf4fd412edf18addf704357c92e8acfa7139f 100644 (file)
@@ -78,6 +78,16 @@ class QuestionCommandLine (_cmd.Cmd):
             return True  # out of questions
         self._reset()
 
+    def do_answer(self, arg):
+        """Explicitly add a line to your answer
+
+        This is useful if the line you'd like to add starts with a
+        quizzer-shell command.  For example:
+
+          quizzer? answer help=5
+        """
+        return self.default(arg)
+
     def do_quit(self, arg):
         "Stop taking the quiz"
         self._reset()