Fix idempotent flags

Add 'overrides_with' to format flags.
Resolves sharkdp/fd#488
This commit is contained in:
Deepansh Sood 2019-10-08 07:40:16 -05:00 committed by David Peter
parent 9491670974
commit 266499800b
1 changed files with 21 additions and 13 deletions

View File

@ -46,9 +46,14 @@ pub fn build_app() -> App<'static, 'static> {
"Note: `fd -h` prints a short and concise overview while `fd --help` \ "Note: `fd -h` prints a short and concise overview while `fd --help` \
gives all details.", gives all details.",
) )
.arg(arg("hidden").long("hidden").short("H")) .arg(
.arg(arg("no-ignore").long("no-ignore").short("I")) arg("hidden")
.arg(arg("no-ignore-vcs").long("no-ignore-vcs")) .long("hidden")
.short("H")
.overrides_with("hidden")
)
.arg(arg("no-ignore").long("no-ignore").short("I").overrides_with("no-ignore"))
.arg(arg("no-ignore-vcs").long("no-ignore-vcs").overrides_with("no-ignore-vcs"))
.arg( .arg(
arg("rg-alias-hidden-ignore") arg("rg-alias-hidden-ignore")
.short("u") .short("u")
@ -60,36 +65,38 @@ pub fn build_app() -> App<'static, 'static> {
arg("case-sensitive") arg("case-sensitive")
.long("case-sensitive") .long("case-sensitive")
.short("s") .short("s")
.overrides_with("ignore-case"), .overrides_with_all(&["ignore-case", "case-sensitive"]),
) )
.arg( .arg(
arg("ignore-case") arg("ignore-case")
.long("ignore-case") .long("ignore-case")
.short("i") .short("i")
.overrides_with("case-sensitive"), .overrides_with_all(&["case-sensitive", "ignore-case"]),
) )
.arg( .arg(
arg("glob") arg("glob")
.long("glob") .long("glob")
.short("g") .short("g")
.conflicts_with("fixed-strings"), .conflicts_with("fixed-strings")
.overrides_with("glob"),
) )
.arg( .arg(
arg("regex") arg("regex")
.long("regex") .long("regex")
.overrides_with("glob") .overrides_with_all(&["glob", "regex"])
.hidden_short_help(true), .hidden_short_help(true),
) )
.arg( .arg(
arg("fixed-strings") arg("fixed-strings")
.long("fixed-strings") .long("fixed-strings")
.short("F") .short("F")
.alias("literal"), .alias("literal")
.overrides_with("fixed-strings"),
) )
.arg(arg("absolute-path").long("absolute-path").short("a")) .arg(arg("absolute-path").long("absolute-path").short("a").overrides_with("absolute-path"))
.arg(arg("follow").long("follow").short("L").alias("dereference")) .arg(arg("follow").long("follow").short("L").alias("dereference").overrides_with("follow"))
.arg(arg("full-path").long("full-path").short("p")) .arg(arg("full-path").long("full-path").short("p").overrides_with("full-path"))
.arg(arg("null_separator").long("print0").short("0")) .arg(arg("null_separator").long("print0").short("0").overrides_with("print0"))
.arg(arg("depth").long("max-depth").short("d").takes_value(true)) .arg(arg("depth").long("max-depth").short("d").takes_value(true))
// support --maxdepth as well, for compatibility with rg // support --maxdepth as well, for compatibility with rg
.arg( .arg(
@ -217,7 +224,8 @@ pub fn build_app() -> App<'static, 'static> {
.arg( .arg(
arg("show-errors") arg("show-errors")
.long("show-errors") .long("show-errors")
.hidden_short_help(true), .hidden_short_help(true)
.overrides_with("show-errors"),
) )
.arg(arg("pattern")) .arg(arg("pattern"))
.arg( .arg(