Add ID reporting in imag-habit

This commit is contained in:
Matthias Beyer 2018-11-01 18:07:57 +01:00
parent 96ad41ea4c
commit 502cdf5721

View file

@ -152,7 +152,8 @@ fn create(rt: &Runtime) {
debug!("Builder = {:?}", hb);
hb.build(rt.store()).map_err_trace_exit_unwrap(1);
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);
}
fn delete(rt: &Runtime) {
@ -370,6 +371,13 @@ fn today(rt: &Runtime, future: bool) {
{
let mut v = vec![format!("{}", i)];
let mut list = lister_fn(&e);
{
let _ = rt
.report_touched(e.get_location())
.map_err_trace_exit_unwrap(1);
}
v.append(&mut list);
table.add_row(v.iter().map(|s| Cell::new(s)).collect());
empty = false;
@ -426,6 +434,13 @@ fn list(rt: &Runtime) {
.for_each(|(i, e)| {
let mut v = vec![format!("{}", i)];
let mut list = lister_fn(&e);
{
let _ = rt
.report_touched(e.get_location())
.map_err_trace_exit_unwrap(1);
}
v.append(&mut list);
table.add_row(v.iter().map(|s| Cell::new(s)).collect());
empty = false;
@ -443,7 +458,6 @@ fn show(rt: &Runtime) {
.map(String::from)
.unwrap(); // safe by clap
fn instance_lister_fn(i: &FileLockEntry) -> Vec<String> {
use libimagutil::date::date_to_string;
use libimaghabit::instance::HabitInstance;
@ -499,6 +513,13 @@ fn show(rt: &Runtime) {
.for_each(|(i, e)| {
let mut v = vec![format!("{}", i)];
let mut instances = instance_lister_fn(&e);
{
let _ = rt
.report_touched(e.get_location())
.map_err_trace_exit_unwrap(1);
}
v.append(&mut instances);
table.add_row(v.iter().map(|s| Cell::new(s)).collect());
empty = false;
@ -555,6 +576,12 @@ fn done(rt: &Runtime) {
next_instance_name);
}
{
let _ = rt
.report_touched(r.get_location())
.map_err_trace_exit_unwrap(1);
}
}
info!("Done.");
}