diff options
| author | Lucas Trzesniewski <lucas.trzesniewski@gmail.com> | 2025-08-05 20:46:36 +0200 |
|---|---|---|
| committer | Ellie Huxtable <ellie@elliehuxtable.com> | 2025-09-18 12:58:42 -0700 |
| commit | 8c18b2e960bd843b7589bc1e68c26deafa8693f9 (patch) | |
| tree | 7a2618926267616f8f04cfa70d1078bac07cb11c /crates/atuin-common/src/shell.rs | |
| parent | fix: remove __atuin_chain_command__ prefix (diff) | |
| download | atuin-8c18b2e960bd843b7589bc1e68c26deafa8693f9.zip | |
refactor: shell environment variables
Diffstat (limited to 'crates/atuin-common/src/shell.rs')
| -rw-r--r-- | crates/atuin-common/src/shell.rs | 6 |
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() |
