Skip to content

Commit

Permalink
Merge pull request #21 from jacderida/relax-shell-check
Browse files Browse the repository at this point in the history
fix: relax check for shell on macos
  • Loading branch information
grumbach committed Aug 16, 2023
2 parents dad999b + d5c3a9a commit eb24a45
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,19 @@ fn get_shell_profile_path() -> Result<PathBuf> {
#[cfg(target_os = "macos")]
fn get_shell_profile_path() -> Result<PathBuf> {
let profile_file_name = match std::env::var("SHELL") {
Ok(shell) => match shell.as_str() {
"/bin/bash" => ".bashrc",
"/bin/zsh" => ".zshrc",
_ => return Err(eyre!("shell {shell} is not supported by safeup")),
},
Ok(shell) => {
let pb = PathBuf::from(shell.clone());
let shell_bin_name = pb
.file_stem()
.ok_or_else(|| eyre!(format!("Unable to obtain file stem from {shell}")))?
.to_string_lossy()
.to_string();
match shell_bin_name.as_str() {
"bash" => ".bashrc",
"zsh" => ".zshrc",
_ => return Err(eyre!("shell {shell} is not supported by safeup")),
}
}
Err(e) => return Err(eyre!(e)),
};
let home_dir_path =
Expand Down

0 comments on commit eb24a45

Please sign in to comment.