-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
💸 $5A-parsingArea: Parser's logic and needs it changed somehow.Area: Parser's logic and needs it changed somehow.C-bugCategory: bugCategory: bug
Milestone
Description
Make sure you completed the following tasks
- Searched the discussions
- Searched the closed issues
Code
use clap::{Arg, App, AppSettings};
fn main() {
let schema = App::new("ripgrep#1701 reproducer")
.setting(AppSettings::AllArgsOverrideSelf)
.arg(Arg::with_name("pretty")
.short("p")
.long("pretty"))
.arg(Arg::with_name("search_zip")
.short("z")
.long("search-zip"));
let test_args = &[
vec!["reproducer", "-pz", "-p"],
vec!["reproducer", "-pzp"],
vec!["reproducer", "-zpp"],
vec!["reproducer", "-pp", "-z"],
vec!["reproducer", "-p", "-p", "-z"],
vec!["reproducer", "-p", "-pz"],
vec!["reproducer", "-ppz"],
];
for argv in test_args {
let matches = schema.clone().get_matches_from_safe(argv);
match matches {
Ok(_) => println!(" OK: {:?}", argv),
Err(e) => println!("ERR: {:?} ({:?})", argv, e.kind),
}
}
}
Steps to reproduce the issue
- Run
cargo run
for the reproducer script
Version
- Rust:
rustc 1.47.0 (18bf6b4f0 2020-10-07)
- Clap: 2.33.3
Actual Behavior Summary
OK: ["reproducer", "-pz", "-p"]
OK: ["reproducer", "-pzp"]
OK: ["reproducer", "-zpp"]
OK: ["reproducer", "-pp", "-z"]
OK: ["reproducer", "-p", "-p", "-z"]
ERR: ["reproducer", "-p", "-pz"] (UnexpectedMultipleUsage)
ERR: ["reproducer", "-ppz"] (UnexpectedMultipleUsage)
I tripped over this when a script that invoked rg -pz
errored out because I had --pretty
in my ripgrep configuration file.
Expected Behavior Summary
All of the strings in the reproducer should behave identically.
Additional context
okdana, BurntSushi and valentin-pBurntSushi
Metadata
Metadata
Assignees
Labels
💸 $5A-parsingArea: Parser's logic and needs it changed somehow.Area: Parser's logic and needs it changed somehow.C-bugCategory: bugCategory: bug