cli - Command line interface helpers

Complementary definitions to enhance argparse usage with commonly used features.

pycstbox.cli.get_argument_parser(description, **kwargs)

Returns an argument parser with common options already defined

Included pre-defined options:

-L –loglevel –debug

Parameters:
  • description (str) – Brief description of the script
  • kwargs – named arguments for ArgumentParser constructor
pycstbox.cli.add_config_file_option_to_parser(parser, dflt_name)

Adds the command-line option to the parser for providing the path of the configuration file

The default name provided will be used to build the full path of the configuration file, which directory is defined by CONFIG_DIR

Parameters:
  • parser (argparse.ArgumentParser) – The parser to which the option will be added. Cannot be None
  • dflt_name (str) – the default name of the file. Cannot be None or empty