yapx.cmd¶
Modify properties of a subcommand.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
function |
Union[None, Command, Callable[..., Any]]
|
the function called when this subcommand is provided. |
None
|
name |
Optional[str]
|
the name of the subcommand added to the parser. |
None
|
**kwargs |
Any
|
passed to the |
{}
|
Returns:
Type | Description |
---|---|
Command
|
... |
Examples:
>>> import yapx
...
>>> def sum_ints(*args: int):
... print(sum(args))
...
>>> yapx.run_commands([
... yapx.cmd(sum_ints, name="add-nums")
... ], args=["add-nums", "1", "2", "3"])
6