gfw.common.cli.ParametrizedCommand#

class ParametrizedCommand(name, description='', options=None, run=<function ParametrizedCommand.<lambda>>, **y)[source]#

Command implementation that is fully parameterized via constructor arguments.

The command’s name, description, CLI options, and run behavior are provided when instantiating this class, allowing quick creation of commands without subclassing.

Parameters:
  • name (str) – The name of the command (used as a CLI argument).

  • help – A brief help message describing what the command does.

  • options (Optional[List[Option]]) – A list of Option instances representing CLI arguments specific to this command.

  • run (Callable[..., Any]) – Callable executed when the command is invoked. It should accept keyword arguments matching the options.

Methods

copy_with

Returns a new command changing some of its properties.

defaults

Returns a dictionary of default values for all CLI options.

run

Execute the command logic.

Attributes

description

The command's description.

header

Returns a descriptive title for the command's options group.

name

The command's name.

options

The command's options.

property name: str#

The command’s name.

property description: str#

The command’s description.

property options: List[Option]#

The command’s options.

run(config, **kwargs)[source]#

Execute the command logic.

Return type:

Any