yapx.cmd¶
Modify properties of a subcommand.
PARAMETER | DESCRIPTION |
---|---|
function
|
the function called when this subcommand is provided.
TYPE:
|
name
|
the name of the subcommand added to the parser.
TYPE:
|
**kwargs
|
passed to the
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Command
|
... |
Examples:
import yapx
def sum_ints(*args: int):
return sum(args)
result = yapx.run_commands(
[yapx.cmd(sum_ints, name="add-nums")], args=["add-nums", "1", "2", "3"]
)
assert result == 6