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 mars_mcd_helper/cli.py
def get_parser() -> argparse.ArgumentParser:
"""
Return the CLI argument parser.
Returns:
An argparse parser.
"""
return argparse.ArgumentParser(prog="mars-mcd-helper")
main(args=None)
¤
Run the main program.
This function is executed when you type mars-mcd-helper
or python -m mars_mcd_helper
.
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 mars_mcd_helper/cli.py
def main(args: Optional[List[str]] = None) -> int:
"""
Run the main program.
This function is executed when you type `mars-mcd-helper` or `python -m mars_mcd_helper`.
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