summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/domain/imag-todo/src/lib.rs24
1 files changed, 16 insertions, 8 deletions
diff --git a/bin/domain/imag-todo/src/lib.rs b/bin/domain/imag-todo/src/lib.rs
index db93004d..2b960650 100644
--- a/bin/domain/imag-todo/src/lib.rs
+++ b/bin/domain/imag-todo/src/lib.rs
@@ -308,7 +308,7 @@ fn list_todos(rt: &Runtime, matcher: &StatusMatcher, show_hidden: bool) -> Resul
Ok(todo.get_hidden()?.map(|hid| hid > now).unwrap_or(true))
};
- iter
+ let iter = iter
.filter_map(|r| {
match r.and_then(|e| e.get_status().map(|s| (s, e))) {
Err(e) => Some(Err(e)),
@@ -327,13 +327,21 @@ fn list_todos(rt: &Runtime, matcher: &StatusMatcher, show_hidden: bool) -> Resul
Ok(false) => None,
Err(err) => Some(Err(err)),
},
- })
- .view_all_if(viewer, &mut rt.stdout(), |r| r.as_ref().ok())
- .and_then_ok(|e| e)
- .report_entries_touched(rt, |r| r.as_ref().ok().map(|e| e.get_location().clone()))
- .and_then_ok(|e| e)
- .collect::<Result<Vec<FileLockEntry>>>()
- .map(|_| ())
+ });
+
+ if rt.output_is_pipe() && !rt.output_data_pipe() {
+ iter.report_entries_touched(rt, |r| r.as_ref().ok().map(|e| e.get_location().clone()))
+ .and_then_ok(|e| e)
+ .collect::<Result<Vec<FileLockEntry>>>()
+ .map(|_| ())
+ } else {
+ iter.view_all_if(viewer, &mut rt.stdout(), |r| r.as_ref().ok())
+ .and_then_ok(|e| e)
+ .report_entries_touched(rt, |r| r.as_ref().ok().map(|e| e.get_location().clone()))
+ .and_then_ok(|e| e)
+ .collect::<Result<Vec<FileLockEntry>>>()
+ .map(|_| ())
+ }
};
if rt.ids_from_stdin() {