From e132410e7a526239389d3e8dedbcf5a84f0503b5 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 18 May 2019 01:36:35 +0200 Subject: add support for -l to only output the file name --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 7d3c93d..c1c2bcb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -89,6 +89,10 @@ pub struct Opt { #[structopt(short = "v", long = "invert-match")] invert: bool, + /// Only show the name of matching files. + #[structopt(short = "l", long = "files-with-matches")] + file_name_only: bool, + /// Disable colored output. #[structopt(long = "no-color")] no_color: bool, @@ -241,7 +245,7 @@ fn grep(opt: &Opt) -> Result<(), RuntimeError> { s.spawn(move |_| { if is_log_file(&entry) { if let Some(result) = search_log(&entry, opt).unwrap() { - output::colored(io::stdout(), &result).unwrap(); + output::output(io::stdout(), opt, &result).unwrap(); } } }); -- cgit v1.2.3