Skip to content
Myr

Add --regex option to override --glob

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

authored by sharkdp · committed by David Peter · parent d5da615 · Browse files · 2 files+18 added−1 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−1 removed

  • tests:+8 added−0 removed
  • other:+10 added−1 removed

2 files+18 added−1 removed

modified:src/app.rs+10 added-1 removed
72 unmodified lines
73 .short("g")74 .conflicts_with("fixed-strings"),75 )76 .arg(77 arg("regex")78 .long("regex")79 .overrides_with("glob")80 .hidden_short_help(true),81 )82 .arg(83 arg("fixed-strings")84 .long("fixed-strings")85 .short("F")86 .alias("literal"),
177 unmodified lines
264 unless the pattern contains an uppercase character (smart case).");265 doc!(h, "glob"266 , "Glob-based search (default: regular expression)"267 , "Perform a glob-based search instead of a regular expression search.");268 doc!(h, "regex"269 , "Perform a regex-based search"270 , "Perform a regular-expression based seach (default). This can be used to override --glob.");271 doc!(h, "fixed-strings"272 , "Treat the pattern as a literal string"273 , "Treat the pattern as a literal string instead of a regular expression.");274 doc!(h, "absolute-path"
79 unmodified lines
354 , "the time (in ms) to buffer, before streaming to the console"355 , "Amount of time in milliseconds to buffer, before streaming the search results to \356 the console.");357 doc!(h, "pattern"349 , "the search pattern, a regular expression (optional)");358 , "the search pattern: a regular expression unless '--glob' is used (optional)");359 doc!(h, "path"360 , "the root directory for the filesystem search (optional)"361 , "The directory where the filesystem search is rooted (optional). \362 If omitted, search the current working directory.");
46 unmodified lines
modified:tests/tests.rs+8 added
311 unmodified lines
312 "one/two/C.Foo2",313 );314}315316/// Make sure that --regex overrides --glob317#[test]318fn test_regex_overrides_glob() {319 let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);320321 te.assert_output(&["--glob", "--regex", "Foo2$"], "one/two/C.Foo2");322}323324/// Full path search (--full-path)325#[test]326fn test_full_path() {327 let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);
1024 unmodified lines