Command::flatten_help
flatten_help
Section titled “flatten_help ”Flatten subcommand help into the current command’s help.
Example
Section titled “Example”name = "myprog"flatten-help = true[args]arg1 = {}[[subcommands]]name = "subcommand"about = "a sub command"flatten-help = true[subcommands.args]arg2 = {}[[subcommands.subcommands]]name = "nested"about = "A nested sub command"[subcommands.subcommands.args]arg3 = { long = "arg3" }[[subcommands]]name = "subcommand2"about = "another sub command"[subcommands.args]arg4 = {}
name: myprogflatten-help: trueargs: arg1: {}subcommands:- name: subcommand about: a sub command flatten-help: true args: arg2: {} subcommands: - name: nested about: A nested sub command args: arg3: long: arg3- name: subcommand2 about: another sub command args: arg4: {}
{ "name": "myprog", "flatten-help": true, "args": { "arg1": {} }, "subcommands": [ { "name": "subcommand", "about": "a sub command", "flatten-help": true, "args": { "arg2": {} }, "subcommands": [ { "name": "nested", "about": "A nested sub command", "args": { "arg3": { "long": "arg3" } } } ] }, { "name": "subcommand2", "about": "another sub command", "args": { "arg4": {} } } ]}
myprog --help
Output
Section titled “Output”Usage: myprog [arg1] myprog subcommand [arg2] myprog subcommand nested [OPTIONS] myprog subcommand help [COMMAND] myprog subcommand2 [arg4] myprog help [COMMAND]...
Arguments: [arg1]
Options: -h, --help Print help
myprog subcommand:a sub command -h, --help Print help [arg2]
myprog subcommand nested:A nested sub command --arg3 <arg3> -h, --help Print help
myprog subcommand help:Print this message or the help of the given subcommand(s)
myprog subcommand2:another sub command -h, --help Print help [arg4]
myprog help:Print this message or the help of the given subcommand(s) [COMMAND]... Print help for the subcommand(s)