-
Hello, I am trying the Root CLI help is perfectly fine:
Same applies for root subcommand output:
Problem shows at one more nesting level - first line of help output seems to do the "binary name/root command"
Types used to derive the above behavior with clap #[derive(Parser, Debug)]
#[clap(multicall(true), disable_help_flag(true))]
pub struct RootArgs {
#[clap(subcommand)]
pub command: RootCommand,
}
#[derive(Subcommand, Debug)]
pub enum RootCommand {
#[clap(subcommand, display_order(1))]
Dump(NetconfCommand),
#[clap(subcommand, display_order(1))]
Send(NetconfCommand),
}
pub enum NetconfCommand {
Lock {
#[clap(possible_values(["running", "candidate"]))]
target: Datastore,
},
...
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
#1431 is the issue for display names without hyphens. At the moment, we are looking at resolving that by just allowing users to override the display name for each subcommand. Until clap v4, this will require a I also wonder about the utility of showing the name in the help. I think it fits best when also showing the version but when that isn't shown, it seems a bit redundant. We can't conditionalize that yet though users can provide their own template. Also, in some cases, people would want only the top-level command shown while in others also the subcommand. #1334 might also be of interest in some subcommands. |
Beta Was this translation helpful? Give feedback.
#1431 is the issue for display names without hyphens. At the moment, we are looking at resolving that by just allowing users to override the display name for each subcommand. Until clap v4, this will require a
help_template
to use. With v4, it will be the default.I also wonder about the utility of showing the name in the help. I think it fits best when also showing the version but when that isn't shown, it seems a bit redundant. We can't conditionalize that yet though users can provide their own template. Also, in some cases, people would want only the top-level command shown while in others also the subcommand.
#1334 might also be of interest in some subcommands.