ExternalCommand
- class ExternalCommand
An external CLI command that may be invoked by the command line argument parser.
Implementations must override both
helpandexecuteas they are otherwise abstract!Members defined in
ExternalCommand(6 members)
RAdditional aliases to parse as this command.
RBrief description of this command that will be displayed in
helpof its parent.
RThe name of this command that will also be displayed in
help.
Construct new
ExternalCommandwith the given metadata.
Execute this command.
Print help for this command or its subcommand.
Attributes
- property aliases: Sequence[str]
Additional aliases to parse as this command.
Note that duplicate aliases are hard errors, and will terminate the program.
- property description: str
Brief description of this command that will be displayed in
helpof its parent.By default, only the first paragraph will be displayed. As this command must print verbose
helpon its own, anything after will never be displayed.
- property name: str
The name of this command that will also be displayed in
help.Note that duplicate names are hard errors, and will terminate the program.
Methods
- __init__(name: str, description: str, aliases: Sequence[str] = ()) None
Construct new
ExternalCommandwith the given metadata.
- execute(arguments: list[str], ctx: syside.cli.ExtContext) int
Execute this command.
The argument list contains all arguments after reaching this subcommand. For example,
syside rule --allwill contain"--all"as the only argument ifrulewas an external command.Implementations must return an exit code, otherwise the exact behaviour is up to them.
ctxcontains additional details of this argument parse.
- help(arguments: list[str], ctx: syside.cli.ExtContext) str
Print help for this command or its subcommand.
The argument list contains all arguments after reaching this subcommand. For example,
syside help rule listwill contain"list"as the only argument ifrulewas an external command.To match the behaviour of
helpcommand, all arguments should be further subcommands only. Implementations may assume that verbose help was requested.ctxcontains additional details of this argument parse. Note that thehelpsegment will not appear inctx.path.