Command::subcommands
subcommands
Section titled “subcommands ”Adds multiple subcommands to the list of valid possibilities.
Example
Section titled “Example”name = "myprog"[args]arg1 = {}[[subcommands]]name = "subcommand"about = "a sub command"[subcommands.args]arg2 = {}[[subcommands.subcommands]]name = "nested"about = "A nested sub command"[subcommands.subcommands.args]arg3 = { long = "arg3", action = "append" }[[subcommands]]name = "subcommand2"about = "another sub command"[subcommands.args]arg4 = {}
name: myprogargs: arg1: {}subcommands:- name: subcommand about: a sub command args: arg2: {} subcommands: - name: nested about: A nested sub command args: arg3: long: arg3 action: append- name: subcommand2 about: another sub command args: arg4: {}
{ "name": "myprog", "args": { "arg1": {} }, "subcommands": [ { "name": "subcommand", "about": "a sub command", "args": { "arg2": {} }, "subcommands": [ { "name": "nested", "about": "A nested sub command", "args": { "arg3": { "long": "arg3", "action": "append" } } } ] }, { "name": "subcommand2", "about": "another sub command", "args": { "arg4": {} } } ]}
myprog subcommand nested --arg3 one --arg3 two
Output
Section titled “Output”claptrap__subcommand='subcommand::nested'claptrap_subcommand_nested_arg3=('one' 'two')