Add ripgrep aliases for no-ignore and hidden
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Rav Chandra · committed by David Peter · parent ccb899a · Browse files · 3 files·+33 added−2 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+33 added−2 removed
- tests:+27 added−0 removed
- other:+6 added−2 removed
Provenance
- Commit
4f2d9e7- Tree
b7344e5- Author
Rav Chandra <rav@elysium.co.nz>- Committer
David Peter <sharkdp@users.noreply.github.com>- Parent
ccb899a
3 files changed+33 added−2 removed
modified:src/app.rs+4 added
32 unmodified lines33 .setting(AppSettings::ColoredHelp)34 .setting(AppSettings::DeriveDisplayOrder)35 .arg(arg("hidden").long("hidden").short("H"))36 .arg(arg("no-ignore").long("no-ignore").short("I"))37+ .arg(arg("rg-alias-hidden-ignore").short("u").multiple(true).hidden(true))38 .arg(arg("case-sensitive").long("case-sensitive").short("s"))39 .arg(arg("absolute-path").long("absolute-path").short("a"))40 .arg(arg("follow").long("follow").short("L").alias("dereference"))41 .arg(arg("full-path").long("full-path").short("p"))102 unmodified lines144 doc!(h, "path"145 , "the root directory for the filesystem search (optional)"146 , "The directory where the filesystem search is rooted (optional). \147 If omitted, search the current working directory.");148+ doc!(h, "rg-alias-hidden-ignore"149+ , "Alias for no-ignore and/or hidden"150+ , "Alias for no-ignore ('u') and no-ignore and hidden ('uu')");151 152 h153 }modified:src/main.rs+2 added-2 removed
84 unmodified lines85 86 let config = FdOptions {87 case_sensitive: case_sensitive,88 search_full_path: matches.is_present("full-path"),89- ignore_hidden: !matches.is_present("hidden"),90- read_ignore: !matches.is_present("no-ignore"),89+ ignore_hidden: !(matches.is_present("hidden") || matches.occurrences_of("rg-alias-hidden-ignore") == 2),90+ read_ignore: !(matches.is_present("no-ignore") || matches.is_present("rg-alias-hidden-ignore")),91 follow_links: matches.is_present("follow"),92 null_separator: matches.is_present("null_separator"),93 max_depth: matches.value_of("depth")94 .and_then(|n| usize::from_str_radix(n, 10).ok()),38 unmodified linesmodified:tests/tests.rs+27 added
173 unmodified lines174 one/two/three/d.foo175 one/two/three/directory_foo");176 }177 178+/// Ignored files with ripgrep aliases (-u / -uu)179+#[test]180+fn test_no_ignore_aliases() {181+ let te = TestEnv::new();182+183+ te.assert_output(184+ &["-u", "foo"],185+ "a.foo186+ ignored.foo187+ one/b.foo188+ one/two/c.foo189+ one/two/C.Foo2190+ one/two/three/d.foo191+ one/two/three/directory_foo");192+193+ te.assert_output(194+ &["-uu", "foo"],195+ ".hidden.foo196+ a.foo197+ ignored.foo198+ one/b.foo199+ one/two/c.foo200+ one/two/C.Foo2201+ one/two/three/d.foo202+ one/two/three/directory_foo");203+}204+205 /// Symlinks (--follow)206 #[test]207 fn test_follow() {208 let te = TestEnv::new();143 unmodified lines