mirror of
https://github.com/denisidoro/navi
synced 2025-02-16 12:38:28 +00:00
parent
42ef14c06a
commit
06d728c377
3 changed files with 10 additions and 7 deletions
|
@ -4,7 +4,7 @@ use crate::extractor;
|
|||
use crate::finder::structures::{Opts as FinderOpts, SuggestionType};
|
||||
use crate::finder::Finder;
|
||||
use crate::shell;
|
||||
use crate::shell::{ShellSpawnError, IS_FISH};
|
||||
use crate::shell::ShellSpawnError;
|
||||
use crate::structures::cheat::{Suggestion, VariableMap};
|
||||
use crate::structures::config::Action;
|
||||
use crate::structures::config::Config;
|
||||
|
@ -78,15 +78,13 @@ fn prompt_finder(
|
|||
let mut opts = FinderOpts {
|
||||
overrides,
|
||||
preview: Some(format!(
|
||||
r#"{prefix}navi preview-var "$(cat <<NAVIEOF
|
||||
r#"navi preview-var "$(cat <<NAVIEOF
|
||||
{{+}}
|
||||
NAVIEOF
|
||||
)" "$(cat <<NAVIEOF
|
||||
{{q}}
|
||||
NAVIEOF
|
||||
)" "{name}"; {extra}{suffix}"#,
|
||||
prefix = if *IS_FISH { "bash -c '" } else { "" },
|
||||
suffix = if *IS_FISH { "'" } else { "" },
|
||||
)" "{name}"; {extra}"#,
|
||||
name = variable_name,
|
||||
extra = extra_preview.clone().unwrap_or_default()
|
||||
)),
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use crate::shell;
|
||||
use crate::structures::cheat::VariableMap;
|
||||
use crate::writer;
|
||||
use anyhow::Context;
|
||||
|
@ -144,7 +145,11 @@ impl Finder for FinderChoice {
|
|||
});
|
||||
}
|
||||
|
||||
let child = command.stdin(Stdio::piped()).stdout(Stdio::piped()).spawn();
|
||||
let child = command
|
||||
.env("SHELL", &*shell::SHELL)
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.spawn();
|
||||
|
||||
let mut child = match child {
|
||||
Ok(x) => x,
|
||||
|
|
|
@ -7,7 +7,7 @@ lazy_static! {
|
|||
pub static ref IS_FISH: bool = env_var::get("SHELL")
|
||||
.unwrap_or_else(|_| "".to_string())
|
||||
.contains(&"fish");
|
||||
static ref SHELL: String = env_var::get(env_var::SHELL).unwrap_or_else(|_| "bash".to_string());
|
||||
pub static ref SHELL: String = env_var::get(env_var::SHELL).unwrap_or_else(|_| "bash".to_string());
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
Loading…
Add table
Reference in a new issue