From 88633b8994437180afdd66068cc2c8f02aea1db1 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Mon, 17 Jun 2024 15:36:38 +0100 Subject: feat(gui): automatically install and setup the cli/shell (#2139) * feat(gui): automatically install and setup the cli/shell * add shell config and toasts --- crates/atuin-common/src/shell.rs | 19 +++++++++++++++++++ 1 file changed, 19 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 afdccea7..80cdc742 100644 --- a/crates/atuin-common/src/shell.rs +++ b/crates/atuin-common/src/shell.rs @@ -59,6 +59,25 @@ impl Shell { Shell::from_string(shell.to_string()) } + pub fn config_file(&self) -> Option { + let mut path = if let Some(base) = directories::BaseDirs::new() { + base.home_dir().to_owned() + } else { + return None; + }; + + // TODO: handle all shells + match self { + Shell::Bash => path.push(".bashrc"), + Shell::Zsh => path.push(".zshrc"), + Shell::Fish => path.push(".config/fish/config.fish"), + + _ => return None, + }; + + Some(path) + } + /// Best-effort attempt to determine the default shell /// This implementation will be different across different platforms /// Caller should ensure to handle Shell::Unknown correctly -- cgit v1.3.1