Provide flag to still list external links
This commit is contained in:
parent
64c611847b
commit
69d5c69eea
2 changed files with 15 additions and 2 deletions
|
@ -84,7 +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::iter::NoExternalIter;
|
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();
|
||||||
|
@ -97,7 +97,13 @@ 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(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| {
|
.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