nat.cli.commands.start#

Attributes#

Classes#

StartCommandGroup

A group is a command that nests other commands (or more groups).

Functions#

start_command(→ None)

Run a NAT workflow using a front end configuration.

Module Contents#

logger#
class StartCommandGroup(
name: str | None = None,
invoke_without_command: bool = False,
no_args_is_help: bool | None = None,
subcommand_metavar: str | None = None,
chain: bool = False,
result_callback: collections.abc.Callable[Ellipsis, Any] | None = None,
**attrs: Any,
)#

Bases: click.Group

A group is a command that nests other commands (or more groups).

Parameters:
  • name – The name of the group command.

  • commands – Map names to Command objects. Can be a list, which will use Command.name as the keys.

  • invoke_without_command – Invoke the group’s callback even if a subcommand is not given.

  • no_args_is_help – If no arguments are given, show the group’s help and exit. Defaults to the opposite of invoke_without_command.

  • subcommand_metavar – How to represent the subcommand argument in help. The default will represent whether chain is set or not.

  • chain – Allow passing more than one subcommand argument. After parsing a command’s arguments, if any arguments remain another command will be matched, and so on.

  • result_callback – A function to call after the group’s and subcommand’s callbacks. The value returned by the subcommand is passed. If chain is enabled, the value will be a list of values returned by all the commands. If invoke_without_command is enabled, the value will be the value returned by the group’s callback, or an empty list if chain is enabled.

  • kwargs – Other arguments passed to Command.

Changed in version 8.0: The commands argument can be a list of command objects.

Changed in version 8.2: Merged with and replaces the MultiCommand base class.

_commands: dict[str, click.Command] | None = None#
_registered_front_ends: dict[str, nat.cli.type_registry.RegisteredFrontEndInfo]#
_build_params(
front_end: nat.cli.type_registry.RegisteredFrontEndInfo,
) list[click.Parameter]#
_load_commands() dict[str, click.Command]#
invoke_subcommand(
ctx: click.Context,
cmd_name: str,
config_file: pathlib.Path,
override: tuple[tuple[str, str], Ellipsis],
**kwargs,
) int | None#
get_command(ctx: click.Context, cmd_name: str) click.Command | None#

Given a context and a command name, this returns a Command object if it exists or returns None.

list_commands(ctx: click.Context) list[str]#

Returns a list of subcommand names in the order they should appear.

start_command(ctx: click.Context, **kwargs) None#

Run a NAT workflow using a front end configuration.