Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use zshenv over zshrc in setup #1657

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

gautamprikshit1
Copy link
Contributor

Copy link
Contributor

@chriskrycho chriskrycho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Thank you!

Copy link
Contributor

@chriskrycho chriskrycho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what we have here is good, and we will also need to update the install.sh.in script, which only checks for .zshrc to identify the current shell:

case "$(basename "/$SHELL")" in
bash)
# Shells on macOS default to opening with a login shell, while Linuxes
# default to a *non*-login shell, so if this is macOS we look for
# `.bash_profile` first; if it's Linux, we look for `.bashrc` first. The
# `*` fallthrough covers more than just Linux: it's everything that is not
# macOS (Darwin). It can be made narrower later if need be.
case $(uname) in
Darwin)
echo_fexists "$HOME/.bash_profile" || echo_fexists "$HOME/.bashrc"
;;
*)
echo_fexists "$HOME/.bashrc" || echo_fexists "$HOME/.bash_profile"
;;
esac
;;
zsh)
echo "$HOME/.zshrc"
;;
fish)
echo "$HOME/.config/fish/config.fish"
;;
*)
# Fall back to checking for profile file existence. Once again, the order
# differs between macOS and everything else.
local profiles
case $(uname) in
Darwin)
profiles=( .profile .bash_profile .bashrc .zshrc .config/fish/config.fish )
;;
*)
profiles=( .profile .bashrc .bash_profile .zshrc .config/fish/config.fish )
;;
esac
for profile in "${profiles[@]}"; do
echo_fexists "$HOME/$profile" && break
done
;;

If you can knock that out as well, we can get this merged!

Copy link
Contributor

@chriskrycho chriskrycho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent! Much obliged!

@chriskrycho chriskrycho merged commit 8c95b61 into volta-cli:main Jan 23, 2024
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Target .zshenv over .zshrc
2 participants