Add id reporting in imag-diary

This commit is contained in:
Matthias Beyer 2018-10-06 12:50:20 +02:00
parent 8523ae2120
commit 2ca6be8322
4 changed files with 21 additions and 1 deletions

View File

@ -43,6 +43,8 @@ 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 res = if rt.cli().subcommand_matches("create").unwrap().is_present("no-edit") {
debug!("Not editing new diary entry");
Ok(())

View File

@ -66,6 +66,10 @@ pub fn delete(rt: &Runtime) {
return;
}
let _ = rt
.report_touched(&to_del_location)
.map_err_trace_exit_unwrap(1);
let _ = rt
.store()
.delete(to_del_location)

View File

@ -54,6 +54,12 @@ pub fn list(rt: &Runtime) {
ids.into_iter()
.map(IntoStoreId::into_storeid)
.trace_unwrap_exit(1)
.for_each(|id| writeln!(rt.stdout(), "{}", id).to_exit_code().unwrap_or_exit());
.for_each(|id| {
let _ = rt
.report_touched(&id)
.map_err_trace_exit_unwrap(1);
writeln!(rt.stdout(), "{}", id).to_exit_code().unwrap_or_exit()
});
}

View File

@ -41,6 +41,14 @@ pub fn view(rt: &Runtime) {
::std::process::exit(1)
}));
let entries = entries.map(|e| {
let _ = rt
.report_touched(e.get_location())
.map_err_trace_exit_unwrap(1);
e
});
let out = rt.stdout();
DV::new(hdr).view_entries(entries, &mut out.lock())
.map_err_trace_exit_unwrap(1);