Ambiguous property: Command.name
#5282
-
Hi there, I've just started using For example, suppose I have the following in my [package]
name = "my-prog" and in use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(name = "different-name")]
struct Cli {
#[command(subcommand)]
command: Commands
}
#[derive(Subcommand)]
enum Commands {
Start
}
fn main() {
let args = Cli::parse();
match args.command {
Commands::Start => println!("Hello, World!")
}
} I would have thought after |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
Command::name
unfortunately cannot change anything about how cargo compiles your binary.Command::name
is implicitly set for subcommands, like youStart
subcommand. For top-level commands, it can act as a display name in--help
though we no longer add it to--help
by default. One example use is cargo subcommands.