Skip to content

cli.py

Module that contains the command line application.

get_parser()

Return the CLI argument parser.

Returns:

Type Description
ArgumentParser

An argparse parser.

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

    Returns:
        An argparse parser.
    """
    return argparse.ArgumentParser(prog="wssh")

main(args=None)

Run the main program.

This function is executed when you type wssh or python -m wizardwebssh.

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 wizardwebssh/cli.py
def main(args: Optional[List[str]] = None) -> int:
    """
    Run the main program.

    This function is executed when you type `wssh` or `python -m wizardwebssh`.

    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