diff --git a/Cargo.lock b/Cargo.lock index 54c420de..1b28c976 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,7 +3,7 @@ name = "ripgrep" version = "0.3.1" dependencies = [ "bytecount 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.18.0 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.19.1 (registry+https://github.com/rust-lang/crates.io-index)", "ctrlc 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "grep 0.1.4", @@ -48,7 +48,7 @@ dependencies = [ [[package]] name = "clap" -version = "2.18.0" +version = "2.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -333,7 +333,7 @@ dependencies = [ "checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6" "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" "checksum bytecount 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49e3c21915578e2300b08d3c174a8ac887e0c6421dff86fdc4d741dc29e5d413" -"checksum clap 2.18.0 (registry+https://github.com/rust-lang/crates.io-index)" = "40046b8a004bf3ba43b9078bf4b9b6d1708406a234848f925dbd7160a374c8a8" +"checksum clap 2.19.1 (registry+https://github.com/rust-lang/crates.io-index)" = "956cee0b2427dd9e71129a509d1ef17a7f5df9f8253924074d7a5d79bc61851e" "checksum crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0c5ea215664ca264da8a9d9c3be80d2eaf30923c259d03e870388eb927508f97" "checksum ctrlc 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "77f98bb69e3fefadcc5ca80a1368a55251f70295168203e01165bcaecb270891" "checksum env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "15abd780e45b3ea4f76b4e9a26ff4843258dd8a3eed2775a0e7368c2e7936c2f" diff --git a/Cargo.toml b/Cargo.toml index a9893650..65df5bc9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ path = "tests/tests.rs" [dependencies] bytecount = "0.1.4" -clap = "~2.18.0" +clap = "~2.19.0" ctrlc = "2.0" env_logger = "0.3" grep = { version = "0.1.4", path = "grep" } diff --git a/src/app.rs b/src/app.rs index 937529f3..fe80a069 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use clap::{App, AppSettings, Arg}; +use clap::{App, AppSettings, Arg, ArgSettings}; const ABOUT: &'static str = " ripgrep (rg) recursively searches your current directory for a regex pattern. @@ -74,6 +74,7 @@ fn app(next_line_help: bool, doc: F) -> App<'static, 'static> .arg(arg("path").multiple(true)) .arg(flag("regexp").short("e") .takes_value(true).multiple(true).number_of_values(1) + .set(ArgSettings::AllowLeadingHyphen) .value_name("pattern")) .arg(flag("files") // This should also conflict with `pattern`, but the first file diff --git a/tests/tests.rs b/tests/tests.rs index 37e9678d..c21fffc9 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -1263,6 +1263,18 @@ fn regression_64() { assert_eq!(lines, path("foo/abc\n")); } +// See: https://github.com/BurntSushi/ripgrep/issues/270 +#[test] +fn regression_270() { + let wd = WorkDir::new("regression_270"); + wd.create("foo", "-test"); + + let mut cmd = wd.command(); + cmd.arg("-e").arg("-test"); + let lines: String = wd.stdout(&mut cmd); + assert_eq!(lines, path("foo:-test\n")); +} + #[test] fn type_list() { let wd = WorkDir::new("type_list");