Skip to content

cli

Module that contains the command line application.

get_parser

get_parser() -> ArgumentParser

Return the CLI argument parser.

Returns:

Source code in src/robot_markdown/cli.py
33
34
35
36
37
38
39
40
41
42
43
def get_parser() -> argparse.ArgumentParser:
    """Return the CLI argument parser.

    Returns:
        An argparse parser.
    """
    parser = argparse.ArgumentParser(prog="robot-markdown")
    parser.add_argument("-v", "--version", action="version", version=f"%(prog)s {debug.get_version()}")
    parser.add_argument("--debug-info", action=_DebugInfo, help="Print debug information.")
    parser.add_argument("file", help="RobotFramework output.xml file.")
    return parser

main

main(args: list[str] | None = None) -> int

Run the main program.

This function is executed when you type robot-markdown or python -m robot_markdown.

Parameters:

  • args (list[str] | None, default: None ) –

    Arguments passed from the command line.

Returns:

  • int

    An exit code.

Source code in src/robot_markdown/cli.py
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
def main(args: list[str] | None = None) -> int:
    """Run the main program.

    This function is executed when you type `robot-markdown` or `python -m robot_markdown`.

    Parameters:
        args: Arguments passed from the command line.

    Returns:
        An exit code.
    """
    parser = get_parser()
    opts = parser.parse_args(args=args)
    print(opts)
    renderer = Renderer()
    print(renderer.render(opts.file))

    return 0