elbow_helper.cli_argparse module

argparse command-line interface — the always-available CLI door.

The second of elbow-helper’s surfaces (after the library) and, like every other ai-helpers suite member’s argparse twin, needs no third-party dependency: argparse ships with Python, so elbow-helper works as a CLI the moment the package is installed. Every subcommand is a thin shell over elbow_helper._core_cli; the click twin (elbow-helper-click) drives the exact same core.

Subcommands: knee, elbow, diagnostics, locator.

Consumes: elbow_helper._core_cli, os_helper (logging to stderr). Produces: main() (the elbow-helper console-script entry point).

Author

Warith Harchaoui, <warith.harchaoui@deraison.ai>

elbow_helper.cli_argparse.build_parser()[source]

Construct the full argument parser with every subcommand.

Returns:

The configured parser (used by main() and by the tests).

Return type:

argparse.ArgumentParser

Examples

>>> parser = build_parser()
>>> ns = parser.parse_args(["knee", "--y-values", "0,1,2,3"])
>>> ns.command
'knee'
elbow_helper.cli_argparse.main(argv=None)[source]

Entry point for the elbow-helper console script.

Parameters:

argv (sequence of str, optional) – Argument vector (defaults to sys.argv[1:]).

Returns:

Process exit code (0 on success).

Return type:

int

Examples

>>> main(["knee", "--y-values", "0,0.5,0.9,0.95,0.97,0.98,0.99"])
0