Sub commands in Commager
Creating Subcommands
You can create a command with:
subCommand = commanger.subCommand("subCommand")
subCommand.basicConfig(["h"])
Note
Sub commands are called via the name you specified, so the names cannot contain spaces
Sub commands are generated by this function so don’t try to call the class directly so it might cause problems in the future
Ordering Commands
Sub commands Always go before the main command, eg.
@subCommand.commandU # command U works for sub commands
def sub(*, h):
print(h)
@subCommand2.command
def sub2(hello):
print(hello["h"])
@cmd.command
def main(args):
print("main args: "+str(args))
Note
Sub commands are called like python main.py subCommandName args kwargs
Commangers with subcommands main command can only except keyword arguments. There can only be one layer of subcommands, this may change in the future.
Precautions
Warning
SubCommands paired with main commands can be unstable
Warning
It is likely that some errors may occurr that you cannot fix, I reccomend replacing sub commands with multiple executable files
The warnings above will be worked on but more slowly.