diff options
author | Daniel <kingdread@gmx.de> | 2020-04-25 12:56:47 +0200 |
---|---|---|
committer | Daniel <kingdread@gmx.de> | 2020-04-25 12:56:47 +0200 |
commit | 509e5817e6e035e762840c00fb95b18253b1d269 (patch) | |
tree | c67d5336c5c35b80733b7c9389bf131a252f109c | |
parent | d124265bee159193090f085343b8523bc6387620 (diff) | |
download | raidgrep-509e5817e6e035e762840c00fb95b18253b1d269.tar.gz raidgrep-509e5817e6e035e762840c00fb95b18253b1d269.tar.bz2 raidgrep-509e5817e6e035e762840c00fb95b18253b1d269.zip |
only try regex if word doesn't start with -
Since our predicates start with -, this sounds like a good heuristic to
prevent something like "raidgrep -- -player" from silently succeeding
but not doing what the user had intended. In this case, we want the
parse error to show and not treat "-player" as a regex.
-rw-r--r-- | src/main.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index 66b2880..3164bd4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -262,7 +262,7 @@ fn single(opt: &Opt) -> Result<()> { if opt.expression.len() == 1 { let line = &opt.expression[0]; let maybe_filter = build_filter(line); - if maybe_filter.is_err() { + if maybe_filter.is_err() && !line.starts_with('-') { let maybe_regex = Regex::new(line); if let Ok(rgx) = maybe_regex { let filter = filters::player::any( |