armi.cli.entryPoint module

EntryPoint base classes.

See Entry Points.

class armi.cli.entryPoint.EntryPoint[source]

Bases: object

Generic command line entry point.

A valid subclass must provide at least a name class attribute, and may also specify the other class attributes described below.

name: Optional[str] = None

The <command-name> that is used to call the command from the command line

description: Optional[str] = None

A string summarizing the command’s actions. This is summary that is printed when you run python -m armi –list-commands or python -m armi <command-name> –help. If not provided, the docstring of the decorated class will be used instead. In general, the docstring is probably sufficient but this argument allows you to provide a short description of the command while retaining a long and detailed docstring.

settingsArgument: Optional[str] = None

One of {‘optional’, ‘required’, None}, or unspecified. Specifies whether a settings file argument is to be added to the command’s argument parser. If settingsArgument == ‘required’, then a settings file is a required positional argument. If settingsArgument == ‘optional’, then it is an optional positional argument. Finally, if settingsArgument is None, then no settings file argument is added.

splash = True

Whether running the entry point should produce a splash text upon executing.

Setting this to False is useful for utility commands that produce standard output that would be needlessly cluttered by the splash text.

mode: Optional[int] = None

One of {armi.Mode.BATCH, armi.Mode.INTERACTIVE, armi.Mode.GUI}, optional. Specifies the ARMI mode in which the command is run. Default is armi.Mode.BATCH.

addOptions()[source]

Add additional command line options.

Values of options added to self.parser will be available on self.args. Values added with createOptionFromSetting will override the setting values in the settings input file.

See also

createOptionFromSetting

A method often called from here to creat CLI options from application settings.

argparse.ArgumentParser.add_argument

Often called from here using self.parser.add_argument to add custom argparse arguments.

parse_args(args)[source]
parse(args)[source]

Parse the command line arguments, with the command specific arguments.

invoke() Optional[int][source]

Body of the entry point.

This is an abstract method, and must must be overridden in sub-classes.

Returns:

exitcode – Implementations should return an exit code, or None, which is interpreted the same as zero (successful completion).

Return type:

int or None

createOptionFromSetting(settingName: str, additionalAlias: Optional[str] = None, suppressHelp: bool = False)[source]

Create a CLI option from an ARMI setting.

This will override whatever is in the settings file.

Parameters:
  • settingName (str) – the setting name

  • additionalAlises (str) – additional alias for the command line option, be careful and make sure they are all distinct!

  • supressHelp (bool) – option to suppress the help message when using the command line --help function. This is particularly beneficial when many options are being added as they can clutter the --help to be almost unusable.

armi.cli.entryPoint.storeBool(boolDefault, ep)[source]
armi.cli.entryPoint.setSetting(ep)[source]
armi.cli.entryPoint.setCaseTitle(cs)[source]
armi.cli.entryPoint.loadSettings(cs)[source]