summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-05-01 17:42:47 +0200
committerMatthias Beyer <mail@beyermatthias.de>2018-05-01 17:44:14 +0200
commit519b6f7ef2d2d6b7f7e81b1027c3dbe247ea458a (patch)
tree2ea5e38b978162cc929202b466e6649caf52efa5 /bin
parent11f9a9027ed75459cfba2419af07047e333f811e (diff)
Refactor imag-habit to new store iterator interface
Diffstat (limited to 'bin')
-rw-r--r--bin/domain/imag-habit/src/main.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/domain/imag-habit/src/main.rs b/bin/domain/imag-habit/src/main.rs
index 61b69bd6..218a0d67 100644
--- a/bin/domain/imag-habit/src/main.rs
+++ b/bin/domain/imag-habit/src/main.rs
@@ -57,6 +57,7 @@ use prettytable::row::Row;
use libimagrt::runtime::Runtime;
use libimagrt::setup::generate_runtime_setup;
use libimagerror::trace::{MapErrTrace, trace_error};
+use libimagerror::iter::TraceIterator;
use libimagerror::exit::ExitUnwrap;
use libimagerror::io::ToExitCode;
use libimaghabit::store::HabitStore;
@@ -167,6 +168,7 @@ fn delete(rt: &Runtime) {
.store()
.all_habit_templates()
.map_err_trace_exit_unwrap(1)
+ .trace_unwrap_exit(1)
.map(|sid| (sid.clone(), rt.store().get(sid).map_err_trace_exit_unwrap(1))) // get the FileLockEntry
.filter(|&(_, ref habit)| match habit { // filter for name of habit == name we look for
&Some(ref h) => h.habit_name().map_err_trace_exit_unwrap(1) == name,
@@ -198,6 +200,7 @@ fn delete(rt: &Runtime) {
fle
.linked_instances()
.map_err_trace_exit_unwrap(1)
+ .trace_unwrap_exit(1)
.filter_map(get_instance)
.filter(has_template_name)
.map(instance_location)
@@ -249,6 +252,7 @@ fn today(rt: &Runtime, future: bool) {
.store()
.all_habit_templates()
.map_err_trace_exit_unwrap(1)
+ .trace_unwrap_exit(1)
.filter_map(|id| match rt.store().get(id.clone()) {
Ok(Some(h)) => Some(h),
Ok(None) => {
@@ -396,6 +400,7 @@ fn list(rt: &Runtime) {
.store()
.all_habit_templates()
.map_err_trace_exit_unwrap(1)
+ .trace_unwrap_exit(1)
.filter_map(|id| match rt.store().get(id.clone()) {
Ok(Some(h)) => Some(h),
Ok(None) => {
@@ -451,6 +456,7 @@ fn show(rt: &Runtime) {
.store()
.all_habit_templates()
.map_err_trace_exit_unwrap(1)
+ .trace_unwrap_exit(1)
.filter_map(|id| get_from_store(rt.store(), id))
.filter(|h| h.habit_name().map(|n| name == n).map_err_trace_exit_unwrap(1))
.enumerate()
@@ -474,6 +480,7 @@ fn show(rt: &Runtime) {
let _ = habit
.linked_instances()
.map_err_trace_exit_unwrap(1)
+ .trace_unwrap_exit(1)
.filter_map(|instance_id| {
debug!("Getting: {:?}", instance_id);
rt.store().get(instance_id).map_err_trace_exit_unwrap(1)
@@ -505,6 +512,7 @@ fn done(rt: &Runtime) {
.store()
.all_habit_templates()
.map_err_trace_exit_unwrap(1)
+ .trace_unwrap_exit(1)
.filter_map(|id| get_from_store(rt.store(), id))
.filter(|h| {
let due = h.next_instance_date().map_err_trace_exit_unwrap(1);