summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-08-31 13:44:19 +0200
committerMatthias Beyer <mail@beyermatthias.de>2019-08-31 13:44:19 +0200
commit74810d9ccc5b41eb41f3d8121ccd9c02634a1455 (patch)
treedf2d4236656f27abfc5593a699a7451fbbe09923
parent47044d9ffea98e1f28efea113175cff61cfd9ef2 (diff)
Fix: Print processed IDs if output is not a pipe.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--bin/core/imag-header/src/main.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/core/imag-header/src/main.rs b/bin/core/imag-header/src/main.rs
index 6a9ce30..b6affe6 100644
--- a/bin/core/imag-header/src/main.rs
+++ b/bin/core/imag-header/src/main.rs
@@ -151,6 +151,7 @@ fn has<'a, 'e, I>(rt: &Runtime, mtch: &ArgMatches<'a>, iter: I)
{
debug!("Processing headers: has value");
let header_path = get_header_path(mtch, "header-value-path");
+ let mut output = rt.stdout();
iter.for_each(|entry| {
trace!("Processing headers: working on {:?}", entry.get_location());
@@ -161,6 +162,9 @@ fn has<'a, 'e, I>(rt: &Runtime, mtch: &ArgMatches<'a>, iter: I)
.is_some()
{
rt.report_touched(entry.get_location()).unwrap_or_exit();
+ if !rt.output_is_pipe() {
+ writeln!(output, "{}", entry.get_location()).to_exit_code().unwrap_or_exit();
+ }
}
})
}
@@ -170,6 +174,7 @@ fn hasnt<'a, 'e, I>(rt: &Runtime, mtch: &ArgMatches<'a>, iter: I)
{
debug!("Processing headers: hasnt value");
let header_path = get_header_path(mtch, "header-value-path");
+ let mut output = rt.stdout();
iter.for_each(|entry| {
trace!("Processing headers: working on {:?}", entry.get_location());
@@ -179,6 +184,9 @@ fn hasnt<'a, 'e, I>(rt: &Runtime, mtch: &ArgMatches<'a>, iter: I)
.map_err_trace_exit_unwrap()
.is_none() {
rt.report_touched(entry.get_location()).unwrap_or_exit();
+ if !rt.output_is_pipe() {
+ writeln!(output, "{}", entry.get_location()).to_exit_code().unwrap_or_exit();
+ }
}
})
}