Fix behavior for fish shell (#498)

Fixes #496
This commit is contained in:
Denis Isidoro 2021-04-12 08:07:45 -03:00 committed by GitHub
parent 9095e376aa
commit eb146fb3f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 12 deletions

View file

@ -5,7 +5,7 @@ use crate::writer;
use crate::finder::structures::{Opts as FinderOpts, SuggestionType};
use crate::finder::Finder;
use crate::shell::{BashSpawnError, IS_FISH};
use crate::shell::BashSpawnError;
use crate::structures::cheat::{Suggestion, VariableMap};
use crate::structures::config::Action;
use crate::structures::config::Config;
@ -71,15 +71,13 @@ fn prompt_finder(
let mut opts = FinderOpts {
overrides: config.fzf_overrides_var.clone(),
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()
)),

View file

@ -1,13 +1,6 @@
use crate::env_var;
use std::fmt::Debug;
use thiserror::Error;
lazy_static! {
pub static ref IS_FISH: bool = env_var::get("SHELL")
.unwrap_or_else(|_| "".to_string())
.contains(&"fish");
}
#[derive(Debug)]
pub enum Shell {
Bash,