Skip to content

CLI

Module that contains the command line application.

get_parser() #

Return the CLI argument parser.

Returns:

Type Description
ArgumentParser

An argparse parser.

Source code in super_image\cli.py
def get_parser() -> argparse.ArgumentParser:
    """
    Return the CLI argument parser.

    Returns:
        An argparse parser.
    """
    return argparse.ArgumentParser(prog="super-image")

main(args=None) #

Run the main program.

This function is executed when you type super-image or python -m super_image.

Parameters:

Name Type Description Default
args Optional[List[str]]

Arguments passed from the command line.

None

Returns:

Type Description
int

An exit code.

Source code in super_image\cli.py
def main(args: Optional[List[str]] = None) -> int:
    """
    Run the main program.

    This function is executed when you type `super-image` or `python -m super_image`.

    Arguments:
        args: Arguments passed from the command line.

    Returns:
        An exit code.
    """
    parser = get_parser()
    opts = parser.parse_args(args=args)
    print(opts)  # noqa: WPS421 (side-effect in main is fine)
    return 0