mirror of
https://github.com/clap-rs/clap
synced 2024-09-20 22:41:52 +00:00
Rename flag parameter to not clash with subcommand
This commit is contained in:
parent
03d4989ef9
commit
6bac0c53bf
1 changed files with 7 additions and 7 deletions
|
@ -166,7 +166,7 @@ fn global_passed_down() {
|
|||
#[derive(Debug, PartialEq, Clap)]
|
||||
struct Opt {
|
||||
#[clap(global = true, long)]
|
||||
global: bool,
|
||||
other: bool,
|
||||
#[clap(subcommand)]
|
||||
sub: Subcommands,
|
||||
}
|
||||
|
@ -180,22 +180,22 @@ fn global_passed_down() {
|
|||
#[derive(Debug, PartialEq, Clap)]
|
||||
struct GlobalCmd {
|
||||
#[clap(from_global)]
|
||||
global: bool,
|
||||
other: bool,
|
||||
}
|
||||
|
||||
assert_eq!(
|
||||
Opt::parse_from(&["test", "global"]),
|
||||
Opt {
|
||||
global: false,
|
||||
sub: Subcommands::Global(GlobalCmd { global: false })
|
||||
other: false,
|
||||
sub: Subcommands::Global(GlobalCmd { other: false })
|
||||
}
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
Opt::parse_from(&["test", "global", "--global"]),
|
||||
Opt::parse_from(&["test", "global", "--other"]),
|
||||
Opt {
|
||||
global: true,
|
||||
sub: Subcommands::Global(GlobalCmd { global: true })
|
||||
other: true,
|
||||
sub: Subcommands::Global(GlobalCmd { other: true })
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue