Skip to content

feat: use zshenv over zshrc in setup#1657

Merged
chriskrycho merged 1 commit intovolta-cli:mainfrom
gautamprikshit1:use-zshenv-over-zshrc
Jan 23, 2024
Merged

feat: use zshenv over zshrc in setup#1657
chriskrycho merged 1 commit intovolta-cli:mainfrom
gautamprikshit1:use-zshenv-over-zshrc

Conversation

@gautamprikshit1
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
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