From 0d1578bbe10620186bc7eaf99fb2b33214d633af Mon Sep 17 00:00:00 2001 From: Matan Kushner Date: Mon, 3 Feb 2020 17:01:50 -0500 Subject: [PATCH] fix: move get_shell method into Context --- src/context.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/context.rs b/src/context.rs index 7a35dd404..6faa78844 100644 --- a/src/context.rs +++ b/src/context.rs @@ -150,6 +150,18 @@ impl<'a> Context<'a> { 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)] @@ -240,18 +252,6 @@ impl DirContents { pub fn has_any_extension(&self, exts: &[&str]) -> bool { 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 {