Skip to content
Myr

Use overrides_with to clean up opposing arg logic

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Vukašin Stepanović · committed by Vukašin Stepanović · parent 8da936a · Browse files · 2 files+18 added−21 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+18 added−21 removed

  • other:+18 added−21 removed

2 files+18 added−21 removed

modified:src/app.rs+6 added-5 removed
30 unmodified lines
31 )32 .arg(33 Arg::with_name("no-hidden")34 .long("no-hidden")35 .overrides_with("no-hidden")35 .overrides_with("hidden")36 .hidden(true)37 .long_help(38 "Overrides --hidden.",39 ),
12 unmodified lines
52 )53 .arg(54 Arg::with_name("ignore")55 .long("ignore")56 .overrides_with("ignore")56 .overrides_with("no-ignore")57 .hidden(true)58 .long_help(59 "Overrides --no-ignore.",60 ),
10 unmodified lines
71 )72 .arg(73 Arg::with_name("ignore-vcs")74 .long("ignore-vcs")75 .overrides_with("ignore-vcs")75 .overrides_with("no-ignore-vcs")76 .hidden(true)77 .long_help(78 "Overrides --no-ignore-vcs.",79 ),
7 unmodified lines
87 .arg(88 Arg::with_name("rg-alias-hidden-ignore")89 .short("u")90 .long("unrestricted")91 .overrides_with_all(&["ignore", "no-hidden"])92 .multiple(true)93 .hidden_short_help(true)94 .long_help(95 "Alias for '--no-ignore'. Can be repeated. '-uu' is an alias for \
69 unmodified lines
165 )166 .arg(167 Arg::with_name("relative-path")168 .long("relative-path")168 .overrides_with("relative-path")169 .overrides_with("absolute-path")170 .hidden(true)171 .long_help(172 "Overrides --absolute-path.",173 ),
26 unmodified lines
200 )201 .arg(202 Arg::with_name("no-follow")203 .long("no-follow")203 .overrides_with("no-follow")204 .overrides_with("follow")205 .hidden(true)206 .long_help(207 "Overrides --follow.",208 ),
457 unmodified lines
modified:src/main.rs+12 added-16 removed
114 unmodified lines
115 if search_paths.is_empty() {116 return Err(anyhow!("No valid search paths given."));117 }118119 if matches.is_present("absolute-path") && !matches.is_present("relative-path") {119 if matches.is_present("absolute-path") {120 search_paths = search_paths121 .iter()122 .map(|path_buffer| {123 path_buffer
208 unmodified lines
332333 let config = Options {334 case_sensitive,335 search_full_path: matches.is_present("full-path"),336 ignore_hidden: matches.is_present("no-hidden")337 || !(matches.is_present("hidden")338 || matches.occurrences_of("rg-alias-hidden-ignore") >= 2),339 read_fdignore: matches.is_present("ignore")340 || !(matches.is_present("no-ignore") || matches.is_present("rg-alias-hidden-ignore")),341 read_vcsignore: matches.is_present("ignore") || matches.is_present("ignore-vcs") || {342 !(matches.is_present("no-ignore")343 || matches.is_present("rg-alias-hidden-ignore")344 || matches.is_present("no-ignore-vcs"))345 },346 read_global_ignore: matches.is_present("ignore")347 || !(matches.is_present("no-ignore")348 || matches.is_present("rg-alias-hidden-ignore")349 || matches.is_present("no-global-ignore-file")),350 follow_links: matches.is_present("follow") && !matches.is_present("no-follow"),336 ignore_hidden: !(matches.is_present("hidden")337 || matches.occurrences_of("rg-alias-hidden-ignore") >= 2),338 read_fdignore: !(matches.is_present("no-ignore")339 || matches.is_present("rg-alias-hidden-ignore")),340 read_vcsignore: !(matches.is_present("no-ignore")341 || matches.is_present("rg-alias-hidden-ignore")342 || matches.is_present("no-ignore-vcs")),343 read_global_ignore: !(matches.is_present("no-ignore")344 || matches.is_present("rg-alias-hidden-ignore")345 || matches.is_present("no-global-ignore-file")),346 follow_links: matches.is_present("follow"),347 one_file_system: matches.is_present("one-file-system"),348 null_separator: matches.is_present("null_separator"),349 max_depth: matches350 .value_of("max-depth")
143 unmodified lines