Add shell configuration to Shell plugin
This commit is contained in:
@@ -7,12 +7,14 @@ use serde::Deserialize;
|
|||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
struct Config {
|
struct Config {
|
||||||
prefix: String,
|
prefix: String,
|
||||||
|
shell: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Config {
|
impl Default for Config {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Config {
|
Config {
|
||||||
prefix: ":sh".to_string(),
|
prefix: ":sh".to_string(),
|
||||||
|
shell: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39,8 +41,14 @@ fn get_matches(input: RString, config: &mut Config) -> RVec<Match> {
|
|||||||
vec![Match {
|
vec![Match {
|
||||||
title: command.into(),
|
title: command.into(),
|
||||||
description: ROption::RSome(
|
description: ROption::RSome(
|
||||||
env::var("SHELL")
|
config
|
||||||
.unwrap_or_else(|_| "No shell!".to_string())
|
.shell
|
||||||
|
.clone()
|
||||||
|
.unwrap_or_else(|| {
|
||||||
|
env::var("SHELL").unwrap_or_else(|_| {
|
||||||
|
"The shell could not be determined!".to_string()
|
||||||
|
})
|
||||||
|
})
|
||||||
.into(),
|
.into(),
|
||||||
),
|
),
|
||||||
icon: ROption::RNone,
|
icon: ROption::RNone,
|
||||||
|
Reference in New Issue
Block a user