cli_interface#

utils.cli_interface.init(args_objs, description=None, prog=None, epilog=None, formatter_class=<class 'rich_argparse.RichHelpFormatter'>)[source]#

DESCRIPTION:

This function initializes a Python ArgumentParser object in accordance with the specified argument SimpleNamespace objects and the respective keyword attributes.

Parameters:
args_objs: Tuple[SimpleNamespace]

A Python tuple of SimpleNamespace objects containing the mandatory, optional, and task arguments.

Keywords:
description: str, optional

A Python string defining the purpose of the respective application/program.

prog: str, optional

A Python string specifying the program name.

epilog: str, optional

A Python string specifying text to be provided at the bottom of a help type message.

formatter_class: Any, optional

A Python Argparse customizing class.

Returns:
parser: ArgumentParser

A Python ArgumentParser object.

Raises:
CLIInterfaceError:
  • raised if the attribute longname has not been specified in an args_obj SimpleNamespace object.

  • raised if an exception is encountered while initializing the CLI.

Return type:

ArgumentParser

utils.cli_interface.options(parser, validate_schema=False, schema_path=None)[source]#

DESCRIPTION:

This function defines a Python SimpleNamespace object containing both the mandatory and the ancillary CLI arguments.

Parameters:
parser: ArgumentParser

A Python ArgumentParser object containing the CLI arguments.

Keywords:
validate_schema: bool, optional

A Python boolean valued variable specifying whether to validate the schema for the respective CLI arguments; if True upon entry, either the CLI arguments must contain the attribute schema or the schema_path must be specified upon entry.

schema_path: str, optional

A Python string specifying the path to the YAML-formatted file containing the CLI argument schema.

Raises:
CLIInterfaceError:
  • raised if the schema_path attribute is NoneType when attempting to validate the CLI argument schema.

Return type:

SimpleNamespace