cli: Add --all for easy review of previously-answered questions
authorW. Trevor King <wking@tremily.us>
Wed, 6 Feb 2013 14:47:26 +0000 (09:47 -0500)
committerW. Trevor King <wking@tremily.us>
Wed, 6 Feb 2013 14:47:26 +0000 (09:47 -0500)
quizzer/cli.py

index d4454fbf325c124f4a1dc85fb9f2486d052baaf4..cadc950f40452ea2cc9519c7e0995a53d9b7a073 100644 (file)
@@ -34,6 +34,10 @@ def main():
     parser.add_argument(
         '-a', '--answers', metavar='ANSWERS', default='answers.json',
         help='path to an answers database')
+    parser.add_argument(
+        '--all', action='store_const', const=True, default=False,
+        help=('ask all questions '
+              '(not just never-correctly-answered leaf questions)'))
     parser.add_argument(
         'quiz', metavar='QUIZ',
         help='path to a quiz file')
@@ -47,7 +51,10 @@ def main():
         answers.load()
     except IOError:
         pass
-    ui = _cli.CommandLineInterface(quiz=quiz, answers=answers)
+    stack = None
+    if args.all:
+        stack = [question for question in quiz]
+    ui = _cli.CommandLineInterface(quiz=quiz, answers=answers, stack=stack)
     ui.run()
     ui.answers.save()
     ui.display_results()