From 6808dccf5c9d87d016734bbffe5779d35aaa70e5 Mon Sep 17 00:00:00 2001 From: Denis Isidoro Date: Mon, 14 Sep 2020 08:48:57 -0300 Subject: [PATCH] Allow variable suggestions to use preview window (#399) --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/cmds/core.rs | 19 ++++++++++++++++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fef4774..7857e68 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -172,7 +172,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "navi" -version = "2.11.0" +version = "2.12.0" dependencies = [ "anyhow 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 3.0.1 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 3865ccf..0fc945d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "navi" -version = "2.11.0" +version = "2.12.0" authors = ["Denis Isidoro "] edition = "2018" description = "An interactive cheatsheet tool for the command-line" diff --git a/src/cmds/core.rs b/src/cmds/core.rs index 3fcd734..d846ee8 100644 --- a/src/cmds/core.rs +++ b/src/cmds/core.rs @@ -59,6 +59,8 @@ fn prompt_finder(variable_name: &str, config: &Config, suggestion: Option<&Sugge env::remove_var(env_vars::PREVIEW_DELIMITER); env::remove_var(env_vars::PREVIEW_MAP); + let mut extra_preview = None; + let (suggestions, opts) = if let Some(s) = suggestion { let (suggestion_command, suggestion_opts) = s; @@ -72,6 +74,9 @@ fn prompt_finder(variable_name: &str, config: &Config, suggestion: Option<&Sugge if let Some(m) = &sopts.map { env::set_var(env_vars::PREVIEW_MAP, m); } + if let Some(p) = &sopts.preview { + extra_preview = Some(format!(";echo;{}", p)); + } } let child = Command::new("bash") @@ -99,13 +104,21 @@ NAVIEOF )" "$(cat <