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

View file

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

View file

@ -54,6 +54,12 @@ pub fn list(rt: &Runtime) {
ids.into_iter() ids.into_iter()
.map(IntoStoreId::into_storeid) .map(IntoStoreId::into_storeid)
.trace_unwrap_exit(1) .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) ::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(); let out = rt.stdout();
DV::new(hdr).view_entries(entries, &mut out.lock()) DV::new(hdr).view_entries(entries, &mut out.lock())
.map_err_trace_exit_unwrap(1); .map_err_trace_exit_unwrap(1);