Merge pull request #842 from matthiasbeyer/imag-link/list-internal-only
Fix: Only list internal links here, no external ones
This commit is contained in:
commit
636bfbb768
2 changed files with 13 additions and 0 deletions
|
@ -84,6 +84,7 @@ fn main() {
|
||||||
|
|
||||||
fn handle_internal_linking(rt: &Runtime) {
|
fn handle_internal_linking(rt: &Runtime) {
|
||||||
use libimagentrylink::internal::InternalLinker;
|
use libimagentrylink::internal::InternalLinker;
|
||||||
|
use libimagentrylink::external::is_external_link_storeid;
|
||||||
|
|
||||||
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();
|
||||||
|
@ -96,6 +97,11 @@ fn handle_internal_linking(rt: &Runtime) {
|
||||||
match get_entry_by_name(rt, entry) {
|
match get_entry_by_name(rt, entry) {
|
||||||
Ok(Some(e)) => {
|
Ok(Some(e)) => {
|
||||||
e.get_internal_links()
|
e.get_internal_links()
|
||||||
|
.map(|iter| {
|
||||||
|
iter.filter(move |id| {
|
||||||
|
cmd.is_present("list-externals-too") || !is_external_link_storeid(&id)
|
||||||
|
})
|
||||||
|
})
|
||||||
.map(|links| {
|
.map(|links| {
|
||||||
let i = links
|
let i = links
|
||||||
.filter_map(|l| {
|
.filter_map(|l| {
|
||||||
|
|
|
@ -71,6 +71,13 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
|
||||||
.required(false)
|
.required(false)
|
||||||
.help("List links to this entry")
|
.help("List links to this entry")
|
||||||
.value_name("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")
|
.subcommand(SubCommand::with_name("external")
|
||||||
.about("Add and remove external links")
|
.about("Add and remove external links")
|
||||||
|
|
Loading…
Reference in a new issue