From f3a03efd5d3272bb79b3fc723f2c2a169d4a8e2c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 17 Oct 2018 14:45:58 +0200 Subject: [PATCH] Add ID reporting in imag-wiki Signed-off-by: Matthias Beyer --- bin/domain/imag-wiki/src/main.rs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/bin/domain/imag-wiki/src/main.rs b/bin/domain/imag-wiki/src/main.rs index 6e586009..c8f55267 100644 --- a/bin/domain/imag-wiki/src/main.rs +++ b/bin/domain/imag-wiki/src/main.rs @@ -170,19 +170,28 @@ fn create(rt: &Runtime, wiki_name: &str) { .map_warn_err_str("Safed entry") .map_err_trace_exit_unwrap(1); + let id = entry.get_location(); + if scmd.is_present("create-printid") { let out = rt.stdout(); let mut lock = out.lock(); - let id = entry.get_location(); writeln!(lock, "{}", id).to_exit_code().unwrap_or_exit() } + + let _ = rt + .report_touched(&id) + .map_err_trace_exit_unwrap(1); } fn create_wiki(rt: &Runtime) { - let scmd = rt.cli().subcommand_matches("create-wiki").unwrap(); // safed by clap - let wiki_name = String::from(scmd.value_of("create-wiki-name").unwrap()); // safe by clap - let _ = rt.store().create_wiki(&wiki_name).map_err_trace_exit_unwrap(1); + let scmd = rt.cli().subcommand_matches("create-wiki").unwrap(); // safed by clap + 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); } fn show(rt: &Runtime, wiki_name: &str) { @@ -239,6 +248,10 @@ fn show(rt: &Runtime, wiki_name: &str) { writeln!(outlock, "{}", entry.get_content()) .to_exit_code() .unwrap_or_exit(); + + let _ = rt + .report_touched(entry.get_location()) + .map_err_trace_exit_unwrap(1); } }