gfw.common.cli.Command#
- class Command[source]#
Abstract base class representing a CLI command or subcommand.
This class defines the essential interface that any command implementation must follow to be compatible with the CLI framework.
Subclasses must provide the command’s name, description, options, and implement the
run()method which contains the command’s logic.- Properties:
- name:
The name of the command (used as the CLI argument, e.g.,
mycli <name>). For subcommands, this distinguishes them from the main command.- description:
A brief help message describing what the subcommand does.
- options:
A list of Option instances representing CLI arguments specific to this subcommand.
- run()[source]#
A callable to execute when the subcommand is invoked. It should accept keyword arguments corresponding to the CLI options.
- Return type:
Methods
Returns a new command changing some of its properties.
Returns a dictionary of default values for all CLI options.
Executes the command logic.
Attributes
The command's description.
Returns a descriptive title for the command's options group.
The name of the command (used as the CLI argument, e.g.,
mycli <name>).The command's options.
- abstract property name: str#
The name of the command (used as the CLI argument, e.g.,
mycli <name>).For subcommands, this distinguishes them from the main command.