quizcomp.cli.pdf.create_question

Create a PDF from a single question.

usage: python3 -m quizcomp.cli.pdf.create_question [-h] [--version]
                                                   [--out-dir OUT_DIR]
                                                   [--skip-tex] [--skip-pdf]
                                                   [--variants VARIANTS]
                                                   [--skip-key] [--seed SEED]
                                                   PATH

Create a PDF from a single question.

positional arguments:
    PATH                The path to a JSON file.

options:
    -h, --help          show this help message and exit
    --version           show program's version number and exit
    --out-dir OUT_DIR   The directory to put the output (default: .).
    --skip-tex          Skip creating TeX files (default: False).
    --skip-pdf          Skip compiling PDFs from TeX (default: False).
    --variants VARIANTS
                        The number of quiz variants to create (default: 1).
    --skip-key          Skip creating the answer key (default: False).
    --seed SEED         The random seed to use (defaults to a random seed).
 1"""
 2Create a PDF from a single question.
 3"""
 4
 5import argparse
 6import sys
 7
 8import quizcomp.cli.parser
 9import quizcomp.util.pdf
10
11def run_cli(args: argparse.Namespace) -> int:
12    """ Run the CLI. """
13
14    quizcomp.util.pdf.make_from_question_with_args(args)
15    return 0
16
17def main() -> int:
18    """ Get a parser, parse the args, and call run. """
19
20    return run_cli(_get_parser().parse_args())
21
22def _get_parser() -> argparse.ArgumentParser:
23    """ Get the parser. """
24
25    parser = quizcomp.cli.parser.get_parser(__doc__.strip(),
26        include_latex = True,
27    )
28
29    quizcomp.util.pdf.modify_parser(parser)
30
31    return parser
32
33if (__name__ == '__main__'):
34    sys.exit(main())
def run_cli(args: argparse.Namespace) -> int:
12def run_cli(args: argparse.Namespace) -> int:
13    """ Run the CLI. """
14
15    quizcomp.util.pdf.make_from_question_with_args(args)
16    return 0

Run the CLI.

def main() -> int:
18def main() -> int:
19    """ Get a parser, parse the args, and call run. """
20
21    return run_cli(_get_parser().parse_args())

Get a parser, parse the args, and call run.