caelus.scripts – CLI App Utilities

Basic CLI Interface

Defines the base classes that are used to build the CLI scripts.

class caelus.scripts.core.CaelusScriptBase(name=None, args=None)[source]

Bases: object

Base class for all Caelus CLI applications.

Defines the common functionality for simple scripts and scripts with sub-commands that are used to access functionality from the library without writing additional python scripts.

Parameters:
  • name (str) – Custom name used in messages

  • args (str) – Pass arguments instead of using sys.argv

cli_options()[source]

Setup the command line options and arguments

setup_logging(log_to_file=True, log_file=None, verbose_level=0, quiet=False)[source]

Setup logging for the script.

Parameters:
  • log_to_file (bool) – If True, script will log to file

  • log_file (path) – Filename to log

  • verbose_level (int) – Level of verbosity

args

Arugments provided by user at the command line

description = 'Caelus CLI Application'

Description of the CLI app used in help messages

epilog = 'Caelus Python Library (CPL) v4.0.0'

Epilog for help messages

name

Custom name when invoked from a python interface instead of command line

parser

Instance of the ArgumentParser used to parse command line arguments

class caelus.scripts.core.CaelusSubCmdScript(name=None, args=None)[source]

Bases: CaelusScriptBase

A CLI app with sub-commands.

Parameters:
  • name (str) – Custom name used in messages

  • args (str) – Pass arguments instead of using sys.argv

cli_options()[source]

Setup sub-parsers.