diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2017-07-07 17:32:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-07 17:32:44 +0200 |
commit | b4d039833305565b9182d9d6ff4e162287a21fbf (patch) | |
tree | 920660397dd0234569a0f4bf923267979cd954e6 | |
parent | e80608c6097cac5a44d16a0d28ae7c1279c8a6a5 (diff) | |
parent | 7ecef14e1b976690de147e36f9b849566fbb74e6 (diff) |
Merge pull request #991 from matthiasbeyer/imag-link/export-consistency-check
Export store-consistency-check from libimagentrylink in UI
-rw-r--r-- | imag-link/src/main.rs | 14 | ||||
-rw-r--r-- | imag-link/src/ui.rs | 7 |
2 files changed, 21 insertions, 0 deletions
diff --git a/imag-link/src/main.rs b/imag-link/src/main.rs index aec3bbaf..2585ed00 100644 --- a/imag-link/src/main.rs +++ b/imag-link/src/main.rs @@ -84,10 +84,24 @@ fn main() { } fn handle_internal_linking(rt: &Runtime) { + use libimagentrylink::internal::store_check::StoreLinkConsistentExt; debug!("Handle internal linking call"); let cmd = rt.cli().subcommand_matches("internal").unwrap(); + if cmd.is_present("check-consistency") { + match rt.store().check_link_consistency() { + Ok(_) => { + info!("Store is consistent"); + return; + } + Err(e) => { + trace_error(&e); + ::std::process::exit(1); + } + } + } + match cmd.value_of("list") { Some(list) => handle_internal_linking_list_call(rt, cmd, list), None => { diff --git a/imag-link/src/ui.rs b/imag-link/src/ui.rs index 0c2a4e13..2b83fb1e 100644 --- a/imag-link/src/ui.rs +++ b/imag-link/src/ui.rs @@ -78,6 +78,13 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .takes_value(false) .required(false) .help("If --list is provided, also list external links (debugging helper that might be removed at some point")) + + .arg(Arg::with_name("check-consistency") + .long("check-consistency") + .short("C") + .takes_value(false) + .required(false) + .help("Check the link-consistency in the store (might be time-consuming)")) ) .subcommand(SubCommand::with_name("external") .about("Add and remove external links") |