From 09e1f9c330ec99de06c834b2de95c378bc6d00d3 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 28 Aug 2020 15:49:12 +0200 Subject: add --count/-n flag --- src/output/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/output/mod.rs') diff --git a/src/output/mod.rs b/src/output/mod.rs index c1cd787..e0b28cc 100644 --- a/src/output/mod.rs +++ b/src/output/mod.rs @@ -14,7 +14,9 @@ use self::{aggregators::Aggregator, formats::Format}; /// Build an pipeline for the given command line options. pub fn build_pipeline(opt: &Opt) -> Pipeline { let stream = io::stdout(); - let aggregator: Box = if let Some(sorting) = &opt.sorting { + let aggregator: Box = if opt.count { + Box::new(aggregators::CountingOutput::new()) + } else if let Some(sorting) = &opt.sorting { Box::new(aggregators::SortedOutput::new(sorting.clone())) } else { Box::new(aggregators::WriteThrough) -- cgit v1.2.3