summaryrefslogtreecommitdiffstats
path: root/bin/domain/imag-wiki
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-10-17 14:45:58 +0200
committerMatthias Beyer <mail@beyermatthias.de>2018-11-06 20:35:18 +0100
commitf3a03efd5d3272bb79b3fc723f2c2a169d4a8e2c (patch)
treea82b22931627a32a6f5feb52ee79bf8c4103afce /bin/domain/imag-wiki
parent029a3c448ed02048d479c20a92d9b6ece4550615 (diff)
Add ID reporting in imag-wiki
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'bin/domain/imag-wiki')
-rw-r--r--bin/domain/imag-wiki/src/main.rs21
1 files 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);
}
}