argclz.commands.sub_command_group#
- argclz.commands.sub_command_group(**kwargs)[source]#
Create a sub-commands group.
>>> class Example(AbstractParser): ... command_group = sub_command_group() ... @command_group('a') ... class SubCommand(AbstractParser): ... ...
The type of
sub_command_group()as an instance-attribute isType[AbstractParser]|None, and its value is handled byset_options()when paring the command-line arguments.Sub command class
When parsing successful (especially when
parse_only=Falsecase), sub-command class (e.g.SubCommandin above example) will be initialized. The__init__could have two different signature, there aredef __init__(self): ... # no-arg init def __init__(self, parent: AbstractParser): ... # one-arg init
where the parameter
parentrefer to its outerAbstractParser(e.g.Examplein above example).