diff --git a/bin/core/imag-link/src/lib.rs b/bin/core/imag-link/src/lib.rs index 1da4172a..9d4f6409 100644 --- a/bin/core/imag-link/src/lib.rs +++ b/bin/core/imag-link/src/lib.rs @@ -140,6 +140,7 @@ fn get_entry_by_name<'a>(rt: &'a Runtime, name: &str) -> Result(rt: &'a Runtime, from: &'a str, to: I) -> Result<()> where I: Iterator { + let directional = rt.cli().is_present("directional"); let mut from_entry = get_entry_by_name(rt, from)?.ok_or_else(|| err_msg("No 'from' entry"))?; for entry in to { @@ -168,7 +169,11 @@ fn link_from_to<'a, I>(rt: &'a Runtime, from: &'a str, to: I) -> Result<()> .get(entr_id)? .ok_or_else(|| format_err!("No 'to' entry: {}", entry))?; - from_entry.add_link(&mut to_entry)?; + if directional { + from_entry.add_link_to(&mut to_entry)?; + } else { + from_entry.add_link(&mut to_entry)?; + } rt.report_touched(to_entry.get_location())?; } diff --git a/bin/core/imag-link/src/ui.rs b/bin/core/imag-link/src/ui.rs index 634a6092..cde5fefd 100644 --- a/bin/core/imag-link/src/ui.rs +++ b/bin/core/imag-link/src/ui.rs @@ -107,6 +107,15 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .help("Link to this entries") .requires("from") .value_name("ENTRIES")) + + .arg(Arg::with_name("directional") + .long("direction") + .takes_value(false) + .required(false) + .multiple(false) + .help("When creating links, make them directional") + .requires_all(&["from", "to"])) + } /// PathProvider