diff --git a/rust/crates/mesc_cli/src/cli/subcommands/setup/command.rs b/rust/crates/mesc_cli/src/cli/subcommands/setup/command.rs index d6a890f..a299c6d 100644 --- a/rust/crates/mesc_cli/src/cli/subcommands/setup/command.rs +++ b/rust/crates/mesc_cli/src/cli/subcommands/setup/command.rs @@ -1,7 +1,7 @@ use crate::{MescCliError, SetupArgs}; use mesc::{MescError, RpcConfig}; -use toolstr::Colorize; use std::path::PathBuf; +use toolstr::Colorize; use super::{config_modification::*, inquire_utils::*, selectors::*, shell_config::*, writing::*}; @@ -25,7 +25,10 @@ pub(crate) async fn setup_command(args: SetupArgs) -> Result<(), MescCliError> { let result = modify_existing_config(config, Some(mode)).await; if shell_config_modified { println!(); - println!("{}", "Shell config files were modified. Restart shell to load these files.".magenta()) + println!( + "{}", + "Shell config files were modified. Restart shell to load these files.".magenta() + ) } result } diff --git a/rust/crates/mesc_cli/src/cli/subcommands/setup/shell_config.rs b/rust/crates/mesc_cli/src/cli/subcommands/setup/shell_config.rs index 1704455..c3de2f5 100644 --- a/rust/crates/mesc_cli/src/cli/subcommands/setup/shell_config.rs +++ b/rust/crates/mesc_cli/src/cli/subcommands/setup/shell_config.rs @@ -19,7 +19,15 @@ pub(crate) fn get_shell_config_paths() -> Result, MescCliError> { let home_dir = std::env::var("HOME").map_err(|_| MescCliError::Error("home dir not found".to_string()))?; let home_path = PathBuf::from(home_dir); - let candidates = vec![home_path.join(".bashrc"), home_path.join(".profile")]; + let mut candidates = vec![home_path.join(".bashrc"), home_path.join(".profile")]; + + // paths added only if they exist + for path in [home_path.join(".zshrc")] { + if path.exists() { + candidates.push(path) + } + } + Ok(candidates) }