aboutsummaryrefslogtreecommitdiffstats
path: root/crates/common/src/shell.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--crates/common/src/shell.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/common/src/shell.rs b/crates/common/src/shell.rs
index 8bab806a..a57250e2 100644
--- a/crates/common/src/shell.rs
+++ b/crates/common/src/shell.rs
@@ -1,4 +1,4 @@
-#[derive(PartialEq)]
+#[derive(PartialEq, Clone, Copy, Debug)]
pub enum Shell {
Sh,
Bash,
@@ -30,12 +30,14 @@ impl std::fmt::Display for Shell {
}
impl Shell {
+ #[must_use]
pub fn from_env() -> Self {
std::env::var("ATUIN_SHELL").map_or(Self::Unknown, |shell| {
Self::from_string(shell.trim().to_lowercase().as_str())
})
}
+ #[must_use]
pub fn from_string(name: &str) -> Self {
match name {
"bash" => Self::Bash,