diff --git a/imag-link/src/main.rs b/imag-link/src/main.rs index d583d5ca..37887915 100644 --- a/imag-link/src/main.rs +++ b/imag-link/src/main.rs @@ -84,7 +84,7 @@ fn main() { fn handle_internal_linking(rt: &Runtime) { use libimagentrylink::internal::InternalLinker; - use libimagentrylink::external::iter::NoExternalIter; + use libimagentrylink::external::is_external_link_storeid; debug!("Handle internal linking call"); let cmd = rt.cli().subcommand_matches("internal").unwrap(); @@ -97,7 +97,13 @@ fn handle_internal_linking(rt: &Runtime) { match get_entry_by_name(rt, entry) { Ok(Some(e)) => { e.get_internal_links() - .map(NoExternalIter::new) + .map(|iter| { + if cmd.is_present("list-externals-too") { + iter.filter(|_| true) + } else { + iter.filter(|id| !is_external_link_storeid(&id)) + } + }) .map(|links| { let i = links .filter_map(|l| { diff --git a/imag-link/src/ui.rs b/imag-link/src/ui.rs index 5c3c3ef1..0c2a4e13 100644 --- a/imag-link/src/ui.rs +++ b/imag-link/src/ui.rs @@ -71,6 +71,13 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .required(false) .help("List links to this entry") .value_name("ENTRY")) + + + .arg(Arg::with_name("list-externals-too") + .long("list-external") + .takes_value(false) + .required(false) + .help("If --list is provided, also list external links (debugging helper that might be removed at some point")) ) .subcommand(SubCommand::with_name("external") .about("Add and remove external links")