aboutsummaryrefslogtreecommitdiffstats
path: root/crates/atuin-common/src/shell.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/atuin-common/src/shell.rs')
-rw-r--r--crates/atuin-common/src/shell.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/atuin-common/src/shell.rs b/crates/atuin-common/src/shell.rs
index 995c7bcb..7f9a7b8f 100644
--- a/crates/atuin-common/src/shell.rs
+++ b/crates/atuin-common/src/shell.rs
@@ -62,6 +62,12 @@ impl Shell {
Shell::from_string(shell.to_string())
}
+ pub fn from_env() -> Shell {
+ std::env::var("ATUIN_SHELL").map_or(Shell::Unknown, |shell| {
+ Shell::from_string(shell.trim().to_lowercase())
+ })
+ }
+
pub fn config_file(&self) -> Option<std::path::PathBuf> {
let mut path = if let Some(base) = directories::BaseDirs::new() {
base.home_dir().to_owned()