summaryrefslogtreecommitdiffstats
path: root/bin/core
diff options
context:
space:
mode:
Diffstat (limited to 'bin/core')
-rw-r--r--bin/core/imag-gps/src/main.rs12
-rw-r--r--bin/core/imag-grep/src/main.rs4
-rw-r--r--bin/core/imag-ids/src/main.rs5
-rw-r--r--bin/core/imag-link/src/main.rs30
-rw-r--r--bin/core/imag-mv/src/main.rs4
-rw-r--r--bin/core/imag-ref/src/main.rs2
-rw-r--r--bin/core/imag-store/src/create.rs2
-rw-r--r--bin/core/imag-store/src/get.rs2
-rw-r--r--bin/core/imag-store/src/retrieve.rs2
-rw-r--r--bin/core/imag-store/src/update.rs2
-rw-r--r--bin/core/imag-store/src/verify.rs2
-rw-r--r--bin/core/imag-tag/src/main.rs8
-rw-r--r--bin/core/imag-view/src/main.rs9
13 files changed, 28 insertions, 56 deletions
diff --git a/bin/core/imag-gps/src/main.rs b/bin/core/imag-gps/src/main.rs
index fe57dc1f..ac673062 100644
--- a/bin/core/imag-gps/src/main.rs
+++ b/bin/core/imag-gps/src/main.rs
@@ -138,9 +138,7 @@ fn add(rt: &Runtime) {
.set_coordinates(c.clone())
.map_err_trace_exit_unwrap(1);
- let _ = rt
- .report_touched(&id)
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(&id).unwrap_or_exit();
});
}
@@ -175,9 +173,7 @@ fn remove(rt: &Runtime) {
let _ = writeln!(rt.stdout(), "{}", removed_value).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();
});
}
@@ -204,9 +200,7 @@ fn get(rt: &Runtime) {
let _ = writeln!(stdout, "{}", value).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();
})
}
diff --git a/bin/core/imag-grep/src/main.rs b/bin/core/imag-grep/src/main.rs
index 2afefd30..9ab3c29d 100644
--- a/bin/core/imag-grep/src/main.rs
+++ b/bin/core/imag-grep/src/main.rs
@@ -125,8 +125,6 @@ fn show(rt: &Runtime, e: &Entry, re: &Regex, opts: &Options, count: &mut usize)
*count += 1;
}
- let _ = rt
- .report_touched(e.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(e.get_location()).unwrap_or_exit();
}
diff --git a/bin/core/imag-ids/src/main.rs b/bin/core/imag-ids/src/main.rs
index 1e9a54fa..2985b133 100644
--- a/bin/core/imag-ids/src/main.rs
+++ b/bin/core/imag-ids/src/main.rs
@@ -127,11 +127,12 @@ fn main() {
trace!("Got output: {:?}", stdout);
iterator.for_each(|id| {
- rt.report_touched(&id).map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(&id).unwrap_or_exit(); // .map_err_trace_exit_unwrap(1);
+
if !rt.output_is_pipe() {
let id = id.to_str().map_err_trace_exit_unwrap(1);
trace!("Writing to {:?}", stdout);
- let _ = writeln!(stdout, "{}", id)
+ writeln!(stdout, "{}", id)
.to_exit_code()
.unwrap_or_exit();
}
diff --git a/bin/core/imag-link/src/main.rs b/bin/core/imag-link/src/main.rs
index 833e4871..79f70a43 100644
--- a/bin/core/imag-link/src/main.rs
+++ b/bin/core/imag-link/src/main.rs
@@ -164,7 +164,7 @@ fn link_from_to<'a, I>(rt: &'a Runtime, from: &'a str, to: I)
.map_err_trace_exit_unwrap(1)
.into_iter();
- let _ = rt.report_all_touched(iter).map_err_trace_exit_unwrap(1);
+ let _ = rt.report_all_touched(iter).unwrap_or_exit();
} else {
debug!("Linking internally: {:?} -> {:?}", from, entry);
@@ -187,18 +187,14 @@ fn link_from_to<'a, I>(rt: &'a Runtime, from: &'a str, to: I)
.add_internal_link(&mut to_entry)
.map_err_trace_exit_unwrap(1);
- let _ = rt
- .report_touched(to_entry.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(to_entry.get_location()).unwrap_or_exit();
}
info!("Ok: {} -> {}", from, entry);
}
- let _ = rt
- .report_touched(from_entry.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(from_entry.get_location()).unwrap_or_exit();
}
fn remove_linking(rt: &Runtime) {
@@ -226,9 +222,7 @@ fn remove_linking(rt: &Runtime) {
.remove_internal_link(&mut from)
.map_err_trace_exit_unwrap(1);
- let _ = rt
- .report_touched(to_entry.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(to_entry.get_location()).unwrap_or_exit();
},
Ok(None) => {
// looks like this is not an entry, but a filesystem URI and therefor an
@@ -250,9 +244,7 @@ fn remove_linking(rt: &Runtime) {
}
});
- let _ = rt
- .report_touched(from.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(from.get_location()).unwrap_or_exit();
}
fn unlink(rt: &Runtime) {
@@ -267,9 +259,7 @@ fn unlink(rt: &Runtime) {
.unlink(rt.store())
.map_err_trace_exit_unwrap(1);
- let _ = rt
- .report_touched(&id)
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(&id).unwrap_or_exit();
});
}
@@ -323,18 +313,14 @@ fn list_linkings(rt: &Runtime) {
})
}
- let _ = rt
- .report_touched(entry.get_location())
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(entry.get_location()).unwrap_or_exit();
},
Ok(None) => warn!("Not found: {}", id),
Err(e) => trace_error(&e),
}
- let _ = rt
- .report_touched(&id)
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(&id).unwrap_or_exit();
});
if !list_plain {
diff --git a/bin/core/imag-mv/src/main.rs b/bin/core/imag-mv/src/main.rs
index d0611210..118f609e 100644
--- a/bin/core/imag-mv/src/main.rs
+++ b/bin/core/imag-mv/src/main.rs
@@ -52,6 +52,7 @@ use std::path::PathBuf;
use libimagrt::setup::generate_runtime_setup;
use libimagerror::trace::MapErrTrace;
use libimagerror::iter::TraceIterator;
+use libimagerror::exit::ExitUnwrap;
use libimagstore::storeid::StoreId;
use libimagstore::store::Store;
use libimagstore::store::FileLockEntry;
@@ -131,8 +132,7 @@ fn main() {
})
.map_err_trace_exit_unwrap(1);
- let _ = rt.report_touched(&destname)
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(&destname).unwrap_or_exit();
// re-add links to moved entry
relink(rt.store(), destname, &mut linked_entries);
diff --git a/bin/core/imag-ref/src/main.rs b/bin/core/imag-ref/src/main.rs
index 2d7e7663..ad72cfec 100644
--- a/bin/core/imag-ref/src/main.rs
+++ b/bin/core/imag-ref/src/main.rs
@@ -102,7 +102,7 @@ fn deref(rt: &Runtime) {
.map(|s| info!("{}", s))
.ok(); // safe here because we exited already in the error case
- let _ = rt.report_touched(&id).map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(&id).unwrap_or_exit();
},
None => {
error!("No entry for id '{}' found", id);
diff --git a/bin/core/imag-store/src/create.rs b/bin/core/imag-store/src/create.rs
index fcfc8ec2..527a89fa 100644
--- a/bin/core/imag-store/src/create.rs
+++ b/bin/core/imag-store/src/create.rs
@@ -63,7 +63,7 @@ pub fn create(rt: &Runtime) {
}
.map_err_trace_exit_unwrap(1);
- let _ = rt.report_touched(&path).map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(&path).unwrap_or_exit();
}
fn create_from_cli_spec(rt: &Runtime, matches: &ArgMatches, path: &StoreId) -> Result<()> {
diff --git a/bin/core/imag-store/src/get.rs b/bin/core/imag-store/src/get.rs
index 271c722d..2f1cf873 100644
--- a/bin/core/imag-store/src/get.rs
+++ b/bin/core/imag-store/src/get.rs
@@ -37,7 +37,7 @@ pub fn get(rt: &Runtime) {
let _ = match rt.store().get(path.clone()).map_err_trace_exit_unwrap(1) {
Some(entry) => {
print_entry(rt, scmd, entry);
- let _ = rt.report_touched(&path).map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(&path).unwrap_or_exit();
},
None => info!("No entry found"),
};
diff --git a/bin/core/imag-store/src/retrieve.rs b/bin/core/imag-store/src/retrieve.rs
index 533e45aa..4a20d33b 100644
--- a/bin/core/imag-store/src/retrieve.rs
+++ b/bin/core/imag-store/src/retrieve.rs
@@ -48,7 +48,7 @@ pub fn retrieve(rt: &Runtime) {
.map_dbg(|e| format!("{:?}", e))
.map_err_trace_exit_unwrap(1);
- let _ = rt.report_touched(&path).map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(&path).unwrap_or_exit();
});
}
diff --git a/bin/core/imag-store/src/update.rs b/bin/core/imag-store/src/update.rs
index 084788e1..1302f3d1 100644
--- a/bin/core/imag-store/src/update.rs
+++ b/bin/core/imag-store/src/update.rs
@@ -49,7 +49,7 @@ pub fn update(rt: &Runtime) {
debug!("New header set");
}
- let _ = rt.report_touched(locked_e.get_location()).map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(locked_e.get_location()).unwrap_or_exit();
});
}
diff --git a/bin/core/imag-store/src/verify.rs b/bin/core/imag-store/src/verify.rs
index cd2f1830..6f2b96a8 100644
--- a/bin/core/imag-store/src/verify.rs
+++ b/bin/core/imag-store/src/verify.rs
@@ -47,7 +47,7 @@ pub fn verify(rt: &Runtime) {
};
info!("{: >6} | {: >14} | {:?}", verify, content_len, p.deref());
- let _ = rt.report_touched(fle.get_location()).map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(fle.get_location()).unwrap_or_exit();
status
});
diff --git a/bin/core/imag-tag/src/main.rs b/bin/core/imag-tag/src/main.rs
index 0aee4af8..982d50ec 100644
--- a/bin/core/imag-tag/src/main.rs
+++ b/bin/core/imag-tag/src/main.rs
@@ -157,9 +157,7 @@ fn alter(rt: &Runtime, path: StoreId, add: Option<Vec<Tag>>, rem: Option<Vec<Tag
},
}
- let _ = rt
- .report_touched(&path)
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(&path).unwrap_or_exit();
}
fn list(path: StoreId, rt: &Runtime) {
@@ -207,9 +205,7 @@ fn list(path: StoreId, rt: &Runtime) {
.unwrap_or_exit();
}
- let _ = rt
- .report_touched(&path)
- .map_err_trace_exit_unwrap(1);
+ let _ = rt.report_touched(&path).unwrap_or_exit();
}
/// Get the tags which should be added from the commandline
diff --git a/bin/core/imag-view/src/main.rs b/bin/core/imag-view/src/main.rs
index 0c2335ba..08c6c0d2 100644
--- a/bin/core/imag-view/src/main.rs
+++ b/bin/core/imag-view/src/main.rs
@@ -98,8 +98,7 @@ fn main() {
let files = entries
.map(|entry| {
let tmpfile = create_tempfile_for(&entry, view_header, hide_content);
- rt.report_touched(entry.get_location())
- .map_err_trace_exit_unwrap(1);
+ rt.report_touched(entry.get_location()).unwrap_or_exit();
tmpfile
})
.collect::<Vec<_>>();
@@ -209,8 +208,7 @@ fn main() {
.view_entry(&entry, &mut outlock)
.map_err_trace_exit_unwrap(1);
- rt.report_touched(entry.get_location())
- .map_err_trace_exit_unwrap(1);
+ rt.report_touched(entry.get_location()).unwrap_or_exit();
});
} else {
let mut viewer = StdoutViewer::new(view_header, !hide_content);
@@ -244,8 +242,7 @@ fn main() {
.view_entry(&entry, &mut outlock)
.map_err_trace_exit_unwrap(1);
- rt.report_touched(entry.get_location())
- .map_err_trace_exit_unwrap(1);
+ rt.report_touched(entry.get_location()).unwrap_or_exit();
});
}
}