Merge pull request #683 from matthiasbeyer/rewrite-storeid-type-imag-link-cleanup
imag-link cleanup
This commit is contained in:
commit
e81f4dfcb6
4 changed files with 25 additions and 1 deletions
|
@ -23,3 +23,6 @@ path = "../libimagentrylink"
|
||||||
[dependencies.libimagerror]
|
[dependencies.libimagerror]
|
||||||
path = "../libimagerror"
|
path = "../libimagerror"
|
||||||
|
|
||||||
|
[dependencies.libimagutil]
|
||||||
|
path = "../libimagutil"
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ extern crate libimagentrylink;
|
||||||
extern crate libimagrt;
|
extern crate libimagrt;
|
||||||
extern crate libimagstore;
|
extern crate libimagstore;
|
||||||
extern crate libimagerror;
|
extern crate libimagerror;
|
||||||
|
extern crate libimagutil;
|
||||||
|
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
@ -36,6 +37,7 @@ use libimagstore::store::FileLockEntry;
|
||||||
use libimagstore::store::Store;
|
use libimagstore::store::Store;
|
||||||
use libimagerror::trace::{trace_error, trace_error_exit};
|
use libimagerror::trace::{trace_error, trace_error_exit};
|
||||||
use libimagentrylink::external::ExternalLinker;
|
use libimagentrylink::external::ExternalLinker;
|
||||||
|
use libimagutil::warn_result::*;
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
|
@ -77,7 +79,16 @@ fn handle_internal_linking(rt: &Runtime) {
|
||||||
Ok(Some(e)) => {
|
Ok(Some(e)) => {
|
||||||
e.get_internal_links()
|
e.get_internal_links()
|
||||||
.map(|links| {
|
.map(|links| {
|
||||||
for (i, link) in links.iter().map(|l| l.to_str().ok()).filter_map(|x| x).enumerate() {
|
let i = links
|
||||||
|
.iter()
|
||||||
|
.filter_map(|l| {
|
||||||
|
l.to_str()
|
||||||
|
.map_warn_err(|e| format!("Failed to convert StoreId to string: {:?}", e))
|
||||||
|
.ok()
|
||||||
|
})
|
||||||
|
.enumerate();
|
||||||
|
|
||||||
|
for (i, link) in i {
|
||||||
println!("{: <3}: {}", i, link);
|
println!("{: <3}: {}", i, link);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -24,3 +24,4 @@ pub mod ismatch;
|
||||||
pub mod iter;
|
pub mod iter;
|
||||||
pub mod key_value_split;
|
pub mod key_value_split;
|
||||||
pub mod variants;
|
pub mod variants;
|
||||||
|
pub mod warn_result;
|
||||||
|
|
9
libimagutil/src/warn_result.rs
Normal file
9
libimagutil/src/warn_result.rs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
generate_result_logging_extension!(
|
||||||
|
WarnResult,
|
||||||
|
map_warn,
|
||||||
|
map_warn_str,
|
||||||
|
map_warn_err,
|
||||||
|
map_warn_err_str,
|
||||||
|
|s| { warn!("{}", s); }
|
||||||
|
);
|
||||||
|
|
Loading…
Reference in a new issue