From 8c18b2e960bd843b7589bc1e68c26deafa8693f9 Mon Sep 17 00:00:00 2001 From: Lucas Trzesniewski Date: Tue, 5 Aug 2025 20:46:36 +0200 Subject: refactor: shell environment variables --- crates/atuin-common/src/shell.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'crates/atuin-common/src/shell.rs') 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 { let mut path = if let Some(base) = directories::BaseDirs::new() { base.home_dir().to_owned() -- cgit v1.3.1