Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add basic support for Elvish #218

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/shell/detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use anyhow::{anyhow, Context, Result};
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum ShellKind {
Bash,
Elvish,
Fish,
Xonsh,
Zsh,
Expand All @@ -16,6 +17,7 @@ impl ShellKind {
pub fn from_str(name: &str) -> Option<ShellKind> {
Some(match name {
"bash" | "dash" => ShellKind::Bash,
"elvish" => ShellKind::Elvish,
"fish" => ShellKind::Fish,
"xonsh" | "python" => ShellKind::Xonsh,
"zsh" => ShellKind::Zsh,
Expand Down
11 changes: 11 additions & 0 deletions src/shell/elvish.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use anyhow::Result;
use std::process::Command;

use crate::shell::ShellSpawnInfo;

pub fn spawn_shell(info: &ShellSpawnInfo) -> Result<()> {
let mut cmd = Command::new("elvish");
info.env_vars.apply(&mut cmd);
let _ = cmd.status()?;
Ok(())
}
5 changes: 5 additions & 0 deletions src/shell/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::vars;

mod bash;
mod detect;
mod elvish;
mod fish;
mod nu;
mod prompt;
Expand Down Expand Up @@ -100,6 +101,9 @@ pub fn spawn_shell(settings: &Settings, config: KubeConfig, session: &Session) -
ShellKind::Bash => {
env_vars.insert("KUBIE_SHELL", "bash");
}
ShellKind::Elvish => {
env_vars.insert("KUBIE_SHELL", "elvish");
}
ShellKind::Fish => {
env_vars.insert("KUBIE_SHELL", "fish");
}
Expand All @@ -122,6 +126,7 @@ pub fn spawn_shell(settings: &Settings, config: KubeConfig, session: &Session) -

match kind {
ShellKind::Bash => bash::spawn_shell(&info),
ShellKind::Elvish => elvish::spawn_shell(&info),
ShellKind::Fish => fish::spawn_shell(&info),
ShellKind::Xonsh => xonsh::spawn_shell(&info),
ShellKind::Zsh => zsh::spawn_shell(&info),
Expand Down