Merge pull request #991 from matthiasbeyer/imag-link/export-consistency-check

Export store-consistency-check from libimagentrylink in UI
This commit is contained in:
Matthias Beyer 2017-07-07 17:32:44 +02:00 committed by GitHub
commit b4d0398333
2 changed files with 21 additions and 0 deletions

View file

@ -84,10 +84,24 @@ fn main() {
} }
fn handle_internal_linking(rt: &Runtime) { fn handle_internal_linking(rt: &Runtime) {
use libimagentrylink::internal::store_check::StoreLinkConsistentExt;
debug!("Handle internal linking call"); debug!("Handle internal linking call");
let cmd = rt.cli().subcommand_matches("internal").unwrap(); 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") { match cmd.value_of("list") {
Some(list) => handle_internal_linking_list_call(rt, cmd, list), Some(list) => handle_internal_linking_list_call(rt, cmd, list),
None => { None => {

View file

@ -78,6 +78,13 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.takes_value(false) .takes_value(false)
.required(false) .required(false)
.help("If --list is provided, also list external links (debugging helper that might be removed at some point")) .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") .subcommand(SubCommand::with_name("external")
.about("Add and remove external links") .about("Add and remove external links")