summaryrefslogtreecommitdiffstats
path: root/imag-todo
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-08-06 10:17:26 +0200
committerMatthias Beyer <mail@beyermatthias.de>2016-08-06 10:17:26 +0200
commitdc78b1553ea54cb3e7c64a3b301affe11686e2fe (patch)
tree8e13522208085c40e68f1954c4a505735608cdce /imag-todo
parent1a01a391f12b68c26a99b352da926a966df94146 (diff)
Comments for listing subcommand
Diffstat (limited to 'imag-todo')
-rw-r--r--imag-todo/src/main.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/imag-todo/src/main.rs b/imag-todo/src/main.rs
index 28aa7464..b0d533b1 100644
--- a/imag-todo/src/main.rs
+++ b/imag-todo/src/main.rs
@@ -109,8 +109,9 @@ fn list(rt: &Runtime) {
let subcmd = rt.cli().subcommand_matches("list").unwrap();
let verbose = subcmd.is_present("verbose");
- let res = Task::all(rt.store())
- .map(|iter| {
+ let res = Task::all(rt.store()) // get all tasks
+ .map(|iter| { // and if this succeeded
+ // filter out the ones were we can read the uuid
let uuids : Vec<_> = iter.filter_map(|t| match t {
Ok(v) => match v.get_header().read("todo.uuid") {
Ok(Some(Value::String(ref u))) => Some(u.clone()),
@@ -131,7 +132,8 @@ fn list(rt: &Runtime) {
})
.collect();
- let outstring = if verbose {
+ // compose a `task` call with them, ...
+ let outstring = if verbose { // ... if verbose
let output = Command::new("task")
.stdin(Stdio::null())
.args(&uuids)
@@ -145,10 +147,11 @@ fn list(rt: &Runtime) {
String::from_utf8(output.stdout)
.unwrap_or_else(|e| panic!("failed to execute: {}", e))
- } else {
+ } else { // ... else just join them
uuids.join("\n")
};
+ /// and then print that
println!("{}", outstring);
});