summaryrefslogtreecommitdiffstats
path: root/bin/domain
diff options
context:
space:
mode:
Diffstat (limited to 'bin/domain')
-rw-r--r--bin/domain/imag-bookmark/src/main.rs22
-rw-r--r--bin/domain/imag-contact/src/create.rs3
-rw-r--r--bin/domain/imag-contact/src/main.rs19
-rw-r--r--bin/domain/imag-diary/src/create.rs2
-rw-r--r--bin/domain/imag-diary/src/delete.rs4
-rw-r--r--bin/domain/imag-diary/src/list.rs4
-rw-r--r--bin/domain/imag-diary/src/view.rs4
-rw-r--r--bin/domain/imag-habit/src/main.rs14
-rw-r--r--bin/domain/imag-log/src/main.rs2
-rw-r--r--bin/domain/imag-mail/src/main.rs4
-rw-r--r--bin/domain/imag-notes/src/main.rs12
-rw-r--r--bin/domain/imag-timetrack/src/cont.rs3
-rw-r--r--bin/domain/imag-timetrack/src/day.rs3
-rw-r--r--bin/domain/imag-timetrack/src/list.rs3
-rw-r--r--bin/domain/imag-timetrack/src/month.rs3
-rw-r--r--bin/domain/imag-timetrack/src/start.rs3
-rw-r--r--bin/domain/imag-timetrack/src/stop.rs3
-rw-r--r--bin/domain/imag-timetrack/src/track.rs3
-rw-r--r--bin/domain/imag-timetrack/src/week.rs3
-rw-r--r--bin/domain/imag-timetrack/src/year.rs3
-rw-r--r--bin/domain/imag-wiki/src/main.rs12
21 files changed, 38 insertions, 91 deletions
diff --git a/bin/domain/imag-bookmark/src/main.rs b/bin/domain/imag-bookmark/src/main.rs
index 7b3237dc..e5c42088 100644
--- a/bin/domain/imag-bookmark/src/main.rs
+++ b/bin/domain/imag-bookmark/src/main.rs
@@ -101,18 +101,14 @@ fn add(rt: &Runtime) {
.ok_or_else(|| format_err!("No bookmark collection '{}' found", coll))
.map_err_trace_exit_unwrap(1);
- let _ = rt
- .report_touched(collection.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(collection.get_location()).unwrap_or_exit();
for url in scmd.values_of("urls").unwrap() { // unwrap saved by clap
let new_ids = collection
.add_link(rt.store(), BookmarkLink::from(url))
.map_err_trace_exit_unwrap(1);
- let _ = rt
- .report_all_touched(new_ids.into_iter())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_all_touched(new_ids.into_iter()).unwrap_or_exit();
}
info!("Ready");
@@ -124,7 +120,7 @@ fn collection(rt: &Runtime) {
if scmd.is_present("add") { // adding a new collection
let name = scmd.value_of("add").unwrap();
if let Ok(id) = BookmarkCollectionStore::new(rt.store(), &name) {
- let _ = rt.report_touched(id.get_location()).map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(id.get_location()).unwrap_or_exit();
info!("Created: {}", name);
} else {
warn!("Creating collection {} failed", name);
@@ -151,9 +147,7 @@ fn list(rt: &Runtime) {
.ok_or_else(|| format_err!("No bookmark collection '{}' found", coll))
.map_err_trace_exit_unwrap(1);
- let _ = rt
- .report_touched(collection.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(collection.get_location()).unwrap_or_exit();
collection
.links(rt.store())
@@ -177,18 +171,14 @@ fn remove(rt: &Runtime) {
.ok_or_else(|| format_err!("No bookmark collection '{}' found", coll))
.map_err_trace_exit_unwrap(1);
- let _ = rt
- .report_touched(collection.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(collection.get_location()).unwrap_or_exit();
for url in scmd.values_of("urls").unwrap() { // enforced by clap
let removed_links = collection
.remove_link(rt.store(), BookmarkLink::from(url))
.map_err_trace_exit_unwrap(1);
- let _ = rt
- .report_all_touched(removed_links.into_iter())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_all_touched(removed_links.into_iter()).unwrap_or_exit();
}
info!("Ready");
diff --git a/bin/domain/imag-contact/src/create.rs b/bin/domain/imag-contact/src/create.rs
index a470cedc..082ed928 100644
--- a/bin/domain/imag-contact/src/create.rs
+++ b/bin/domain/imag-contact/src/create.rs
@@ -204,8 +204,7 @@ pub fn create(rt: &Runtime) {
.create_from_path(&location)
.map_err_trace_exit_unwrap(1);
- let _ = rt.report_touched(entry.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(entry.get_location()).unwrap_or_exit();
info!("Created entry in store");
} else {
diff --git a/bin/domain/imag-contact/src/main.rs b/bin/domain/imag-contact/src/main.rs
index 3385beef..a68ee6a6 100644
--- a/bin/domain/imag-contact/src/main.rs
+++ b/bin/domain/imag-contact/src/main.rs
@@ -125,8 +125,7 @@ fn list(rt: &Runtime) {
.map(|fle| fle.ok_or_else(|| Error::from(err_msg("StoreId not found".to_owned()))))
.trace_unwrap_exit(1)
.map(|fle| {
- let _ = rt.report_touched(fle.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(fle.get_location()).unwrap_or_exit();
fle
})
.map(|e| e.deser())
@@ -171,9 +170,7 @@ fn import(rt: &Runtime) {
.retrieve_from_path(&path)
.map_err_trace_exit_unwrap(1);
- let _ = rt
- .report_touched(entry.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(entry.get_location()).unwrap_or_exit();
} else if path.is_dir() {
for entry in WalkDir::new(path).min_depth(1).into_iter() {
let entry = entry
@@ -187,9 +184,7 @@ fn import(rt: &Runtime) {
.retrieve_from_path(&pb)
.map_err_trace_exit_unwrap(1);
- let _ = rt
- .report_touched(fle.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(fle.get_location()).unwrap_or_exit();
info!("Imported: {}", entry.path().to_str().unwrap_or("<non UTF-8 path>"));
} else {
warn!("Ignoring non-file: {}", entry.path().to_str().unwrap_or("<non UTF-8 path>"));
@@ -228,9 +223,7 @@ fn show(rt: &Runtime) {
.unwrap() // exited above
.starts_with(&hash)
{
- let _ = rt
- .report_touched(entry.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(entry.get_location()).unwrap_or_exit();
Some(deser)
} else {
None
@@ -285,9 +278,7 @@ fn find(rt: &Runtime) {
|| card.fullname().iter().any(|a| str_contains_any(a, &grepstring));
if take {
- let _ = rt
- .report_touched(entry.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(entry.get_location()).unwrap_or_exit();
// optimization so we don't have to parse again in the next step
Some((entry, card))
diff --git a/bin/domain/imag-diary/src/create.rs b/bin/domain/imag-diary/src/create.rs
index 788fd33c..7e7c47b2 100644
--- a/bin/domain/imag-diary/src/create.rs
+++ b/bin/domain/imag-diary/src/create.rs
@@ -45,7 +45,7 @@ pub fn create(rt: &Runtime) {
let mut entry = create_entry(rt.store(), &diaryname, rt);
- let _ = rt.report_touched(entry.get_location()).map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(entry.get_location()).unwrap_or_exit();
let res = if rt.cli().subcommand_matches("create").unwrap().is_present("no-edit") {
debug!("Not editing new diary entry");
diff --git a/bin/domain/imag-diary/src/delete.rs b/bin/domain/imag-diary/src/delete.rs
index 8ce2296a..af719ca7 100644
--- a/bin/domain/imag-diary/src/delete.rs
+++ b/bin/domain/imag-diary/src/delete.rs
@@ -66,9 +66,7 @@ pub fn delete(rt: &Runtime) {
return;
}
- let _ = rt
- .report_touched(&to_del_location)
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(&to_del_location).unwrap_or_exit();
let _ = rt
.store()
diff --git a/bin/domain/imag-diary/src/list.rs b/bin/domain/imag-diary/src/list.rs
index 7294b463..ce6d7480 100644
--- a/bin/domain/imag-diary/src/list.rs
+++ b/bin/domain/imag-diary/src/list.rs
@@ -55,9 +55,7 @@ pub fn list(rt: &Runtime) {
.map(IntoStoreId::into_storeid)
.trace_unwrap_exit(1)
.for_each(|id| {
- let _ = rt
- .report_touched(&id)
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(&id).unwrap_or_exit();
writeln!(rt.stdout(), "{}", id).to_exit_code().unwrap_or_exit()
});
diff --git a/bin/domain/imag-diary/src/view.rs b/bin/domain/imag-diary/src/view.rs
index 5d28b412..dd1c4d66 100644
--- a/bin/domain/imag-diary/src/view.rs
+++ b/bin/domain/imag-diary/src/view.rs
@@ -42,9 +42,7 @@ pub fn view(rt: &Runtime) {
}));
let entries = entries.map(|e| {
- let _ = rt
- .report_touched(e.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(e.get_location()).unwrap_or_exit();
e
});
diff --git a/bin/domain/imag-habit/src/main.rs b/bin/domain/imag-habit/src/main.rs
index 5c7f8a75..3a822ee3 100644
--- a/bin/domain/imag-habit/src/main.rs
+++ b/bin/domain/imag-habit/src/main.rs
@@ -155,7 +155,7 @@ fn create(rt: &Runtime) {
debug!("Builder = {:?}", hb);
let fle = hb.build(rt.store()).map_err_trace_exit_unwrap(1);
- let _ = rt.report_touched(fle.get_location()).map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(fle.get_location()).unwrap_or_exit();
}
fn delete(rt: &Runtime) {
@@ -441,9 +441,7 @@ fn list(rt: &Runtime) {
let mut list = lister_fn(&e);
{
- let _ = rt
- .report_touched(e.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(e.get_location()).unwrap_or_exit();
}
v.append(&mut list);
@@ -520,9 +518,7 @@ fn show(rt: &Runtime) {
let mut instances = instance_lister_fn(&e);
{
- let _ = rt
- .report_touched(e.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(e.get_location()).unwrap_or_exit();
}
v.append(&mut instances);
@@ -582,9 +578,7 @@ fn done(rt: &Runtime) {
}
{
- let _ = rt
- .report_touched(r.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(r.get_location()).unwrap_or_exit();
}
}
diff --git a/bin/domain/imag-log/src/main.rs b/bin/domain/imag-log/src/main.rs
index 900f3e43..525eff7e 100644
--- a/bin/domain/imag-log/src/main.rs
+++ b/bin/domain/imag-log/src/main.rs
@@ -171,7 +171,7 @@ fn show(rt: &Runtime) {
let _ = rt
.report_touched(entry.get_location())
- .map_err_trace_exit_unwrap(1);
+ .unwrap_or_exit();
Ok(())
})
.collect::<Result<Vec<()>, ExitCode>>()
diff --git a/bin/domain/imag-mail/src/main.rs b/bin/domain/imag-mail/src/main.rs
index 35b62368..0a7da7f0 100644
--- a/bin/domain/imag-mail/src/main.rs
+++ b/bin/domain/imag-mail/src/main.rs
@@ -95,7 +95,7 @@ fn import_mail(rt: &Runtime) {
.map_info_str("Ok")
.map_err_trace_exit_unwrap(1);
- let _ = rt.report_touched(mail.fle().get_location()).map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(mail.fle().get_location()).unwrap_or_exit();
}
fn list(rt: &Runtime) {
@@ -147,7 +147,7 @@ fn list(rt: &Runtime) {
to = to
).to_exit_code().unwrap_or_exit();
- let _ = rt.report_touched(m.fle().get_location()).map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(m.fle().get_location()).unwrap_or_exit();
}
let _ = rt.store()
diff --git a/bin/domain/imag-notes/src/main.rs b/bin/domain/imag-notes/src/main.rs
index 8758cbdf..2d9c03b4 100644
--- a/bin/domain/imag-notes/src/main.rs
+++ b/bin/domain/imag-notes/src/main.rs
@@ -112,9 +112,7 @@ fn create(rt: &Runtime) {
.map_err_trace_exit_unwrap(1);
}
- let _ = rt
- .report_touched(note.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(note.get_location()).unwrap_or_exit();
}
fn delete(rt: &Runtime) {
@@ -136,9 +134,7 @@ fn edit(rt: &Runtime) {
.map_warn_err_str("Editing failed")
.map_err_trace_exit_unwrap(1);
- let _ = rt
- .report_touched(note.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(note.get_location()).unwrap_or_exit();
})
.unwrap_or_else(|| {
error!("Cannot find note with name '{}'", name);
@@ -170,9 +166,7 @@ fn list(rt: &Runtime) {
.to_exit_code()
.unwrap_or_exit();
- let _ = rt
- .report_touched(note.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(note.get_location()).unwrap_or_exit();
});
}
diff --git a/bin/domain/imag-timetrack/src/cont.rs b/bin/domain/imag-timetrack/src/cont.rs
index 1e88dd62..60ab9553 100644
--- a/bin/domain/imag-timetrack/src/cont.rs
+++ b/bin/domain/imag-timetrack/src/cont.rs
@@ -87,8 +87,7 @@ pub fn cont(rt: &Runtime) -> i32 {
.map(|_| 0)
.map_err_trace();
- let _ = rt.report_touched(tracking.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(tracking.get_location()).unwrap_or_exit();
val
})
diff --git a/bin/domain/imag-timetrack/src/day.rs b/bin/domain/imag-timetrack/src/day.rs
index 2cff8fb1..6a099043 100644
--- a/bin/domain/imag-timetrack/src/day.rs
+++ b/bin/domain/imag-timetrack/src/day.rs
@@ -103,8 +103,7 @@ pub fn day(rt: &Runtime) -> i32 {
let end = e.get_end_datetime()?;
debug!(" -> end = {:?}", end);
- let _ = rt.report_touched(e.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(e.get_location()).unwrap_or_exit();
Ok((tag, start, end))
})
diff --git a/bin/domain/imag-timetrack/src/list.rs b/bin/domain/imag-timetrack/src/list.rs
index 80019e8c..2e794121 100644
--- a/bin/domain/imag-timetrack/src/list.rs
+++ b/bin/domain/imag-timetrack/src/list.rs
@@ -162,8 +162,7 @@ pub fn list_impl(rt: &Runtime,
.collect();
tab.add_row(Row::new(cells));
- let _ = rt.report_touched(e.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(e.get_location()).unwrap_or_exit();
Ok(tab)
})
diff --git a/bin/domain/imag-timetrack/src/month.rs b/bin/domain/imag-timetrack/src/month.rs
index 8e9e7f60..f5bf99de 100644
--- a/bin/domain/imag-timetrack/src/month.rs
+++ b/bin/domain/imag-timetrack/src/month.rs
@@ -118,8 +118,7 @@ pub fn month(rt: &Runtime) -> i32 {
let end = e.get_end_datetime()?;
debug!(" -> end = {:?}", end);
- let _ = rt.report_touched(e.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(e.get_location()).unwrap_or_exit(1);
Ok((tag, start, end))
})
diff --git a/bin/domain/imag-timetrack/src/start.rs b/bin/domain/imag-timetrack/src/start.rs
index ff440233..39ddea4d 100644
--- a/bin/domain/imag-timetrack/src/start.rs
+++ b/bin/domain/imag-timetrack/src/start.rs
@@ -59,8 +59,7 @@ pub fn start(rt: &Runtime) -> i32 {
1
},
Ok(entry) => {
- let _ = rt.report_touched(entry.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(entry.get_location()).unwrap_or_exit();
acc
}
diff --git a/bin/domain/imag-timetrack/src/stop.rs b/bin/domain/imag-timetrack/src/stop.rs
index 2eee55f5..2fc27bea 100644
--- a/bin/domain/imag-timetrack/src/stop.rs
+++ b/bin/domain/imag-timetrack/src/stop.rs
@@ -98,8 +98,7 @@ pub fn stop(rt: &Runtime) -> i32 {
}
Ok(_) => {
format!("Setting end time worked: {:?}", elem);
- let _ = rt.report_touched(elem.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(elem.get_location()).unwrap_or_exit();
acc
}
}
diff --git a/bin/domain/imag-timetrack/src/track.rs b/bin/domain/imag-timetrack/src/track.rs
index c9171e10..f89047a0 100644
--- a/bin/domain/imag-timetrack/src/track.rs
+++ b/bin/domain/imag-timetrack/src/track.rs
@@ -87,8 +87,7 @@ pub fn track(rt: &Runtime) -> i32 {
1
},
Ok(entry) => {
- let _ = rt.report_touched(entry.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(entry.get_location()).unwrap_or_exit();
acc
}
})
diff --git a/bin/domain/imag-timetrack/src/week.rs b/bin/domain/imag-timetrack/src/week.rs
index e003d2f9..5c384036 100644
--- a/bin/domain/imag-timetrack/src/week.rs
+++ b/bin/domain/imag-timetrack/src/week.rs
@@ -116,8 +116,7 @@ pub fn week(rt: &Runtime) -> i32 {
let end = e.get_end_datetime()?;
debug!(" -> end = {:?}", end);
- let _ = rt.report_touched(e.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(e.get_location()).unwrap_or_exit();
Ok((tag, start, end))
})
diff --git a/bin/domain/imag-timetrack/src/year.rs b/bin/domain/imag-timetrack/src/year.rs
index 4bd48d20..16d30050 100644
--- a/bin/domain/imag-timetrack/src/year.rs
+++ b/bin/domain/imag-timetrack/src/year.rs
@@ -116,8 +116,7 @@ pub fn year(rt: &Runtime) -> i32 {
let end = e.get_end_datetime()?;
debug!(" -> end = {:?}", end);
- let _ = rt.report_touched(e.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(e.get_location()).unwrap_or_exit();
Ok((tag, start, end))
})
diff --git a/bin/domain/imag-wiki/src/main.rs b/bin/domain/imag-wiki/src/main.rs
index 179b3005..a32960f6 100644
--- a/bin/domain/imag-wiki/src/main.rs
+++ b/bin/domain/imag-wiki/src/main.rs
@@ -181,9 +181,7 @@ fn create(rt: &Runtime, wiki_name: &str) {
writeln!(lock, "{}", id).to_exit_code().unwrap_or_exit()
}
- let _ = rt
- .report_touched(&id)
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(&id).unwrap_or_exit();
}
fn create_wiki(rt: &Runtime) {
@@ -191,9 +189,7 @@ fn create_wiki(rt: &Runtime) {
let wiki_name = String::from(scmd.value_of("create-wiki-name").unwrap()); // safe by clap
let (_, index) = rt.store().create_wiki(&wiki_name).map_err_trace_exit_unwrap(1);
- let _ = rt
- .report_touched(index.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(index.get_location()).unwrap_or_exit();
}
fn show(rt: &Runtime, wiki_name: &str) {
@@ -251,9 +247,7 @@ fn show(rt: &Runtime, wiki_name: &str) {
.to_exit_code()
.unwrap_or_exit();
- let _ = rt
- .report_touched(entry.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(entry.get_location()).unwrap_or_exit();
}
}