aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorDaniel <kingdread@gmx.de>2019-06-03 02:02:44 +0200
committerDaniel <kingdread@gmx.de>2019-06-03 02:02:44 +0200
commit5d2f51ab8593946a0f24db367a887a37258901d5 (patch)
tree498f2af9584046ed63f256375169bbf5756bfb7d /src/main.rs
parentc731b470fc162e56f6d81c475bacb41230a5e2d3 (diff)
downloadraidgrep-5d2f51ab8593946a0f24db367a887a37258901d5.tar.gz
raidgrep-5d2f51ab8593946a0f24db367a887a37258901d5.tar.bz2
raidgrep-5d2f51ab8593946a0f24db367a887a37258901d5.zip
[WIP] rewrite output logic as a pipeline
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 89dab09..dbb8f36 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -285,6 +285,7 @@ fn is_log_file(entry: &DirEntry) -> bool {
/// Run the grep search with the given options.
fn grep(opt: &Opt) -> Result<(), RuntimeError> {
+ let pipeline = &output::build_pipeline(opt);
rayon::scope(|s| {
let walker = WalkDir::new(&opt.path);
for entry in walker {
@@ -294,7 +295,7 @@ fn grep(opt: &Opt) -> Result<(), RuntimeError> {
let search = search_log(&entry, opt);
match search {
Ok(None) => (),
- Ok(Some(result)) => output::output(io::stdout(), opt, &result).unwrap(),
+ Ok(Some(result)) => pipeline.push_item(&result),
Err(err) => {
debug!("Runtime error while scanning {:?}: {}", entry.path(), err);
}