mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-12-01 09:13:54 +00:00
fix: move get_shell method into Context
This commit is contained in:
parent
cb6819c7d8
commit
0d1578bbe1
@ -150,6 +150,18 @@ impl<'a> Context<'a> {
|
|||||||
DirContents::from_path_with_timeout(&self.current_dir, timeout)
|
DirContents::from_path_with_timeout(&self.current_dir, timeout)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_shell() -> Shell {
|
||||||
|
let shell = std::env::var("STARSHIP_SHELL").unwrap_or_default();
|
||||||
|
match shell.as_str() {
|
||||||
|
"bash" => Shell::Bash,
|
||||||
|
"fish" => Shell::Fish,
|
||||||
|
"ion" => Shell::Ion,
|
||||||
|
"powershell" => Shell::PowerShell,
|
||||||
|
"zsh" => Shell::Zsh,
|
||||||
|
_ => Shell::Unknown,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@ -240,18 +252,6 @@ impl DirContents {
|
|||||||
pub fn has_any_extension(&self, exts: &[&str]) -> bool {
|
pub fn has_any_extension(&self, exts: &[&str]) -> bool {
|
||||||
exts.iter().any(|ext| self.has_extension(ext))
|
exts.iter().any(|ext| self.has_extension(ext))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_shell() -> Shell {
|
|
||||||
let shell = std::env::var("STARSHIP_SHELL").unwrap_or_default();
|
|
||||||
match shell.as_str() {
|
|
||||||
"bash" => Shell::Bash,
|
|
||||||
"fish" => Shell::Fish,
|
|
||||||
"ion" => Shell::Ion,
|
|
||||||
"powershell" => Shell::PowerShell,
|
|
||||||
"zsh" => Shell::Zsh,
|
|
||||||
_ => Shell::Unknown,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Repo {
|
pub struct Repo {
|
||||||
|
Loading…
Reference in New Issue
Block a user