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

Check if fnm is installed before shell setup #937

Merged
merged 3 commits into from
May 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 27 additions & 27 deletions .ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,29 +168,29 @@ setup_shell() {
CONF_FILE=${ZDOTDIR:-$HOME}/.zshrc
ensure_containing_dir_exists "$CONF_FILE"
echo "Installing for Zsh. Appending the following to $CONF_FILE:"
echo ""
echo ' # fnm'
echo ' export PATH="'"$INSTALL_DIR"':$PATH"'
echo ' eval "`fnm env`"'

echo '' >>$CONF_FILE
echo '# fnm' >>$CONF_FILE
echo 'export PATH="'$INSTALL_DIR':$PATH"' >>$CONF_FILE
echo 'eval "`fnm env`"' >>$CONF_FILE
{
echo ''
echo '# fnm'
echo 'FNM_PATH="'"$INSTALL_DIR"'"'
echo 'if [ -d "$FNM_PATH" ]; then'
echo ' export PATH="'$INSTALL_DIR':$PATH"'
echo ' eval "`fnm env`"'
echo 'fi'
} | tee -a "$CONF_FILE"

elif [ "$CURRENT_SHELL" = "fish" ]; then
CONF_FILE=$HOME/.config/fish/conf.d/fnm.fish
ensure_containing_dir_exists "$CONF_FILE"
echo "Installing for Fish. Appending the following to $CONF_FILE:"
echo ""
echo ' # fnm'
echo ' set PATH "'"$INSTALL_DIR"'" $PATH'
echo ' fnm env | source'

echo '' >>$CONF_FILE
echo '# fnm' >>$CONF_FILE
echo 'set PATH "'"$INSTALL_DIR"'" $PATH' >>$CONF_FILE
echo 'fnm env | source' >>$CONF_FILE
{
echo ''
echo '# fnm'
echo 'set FNM_PATH "'"$INSTALL_DIR"'"'
echo 'if [ -d "$FNM_PATH" ]'
echo ' set PATH "$FNM_PATH" $PATH'
echo ' fnm env | source'
echo 'end'
} | tee -a "$CONF_FILE"

elif [ "$CURRENT_SHELL" = "bash" ]; then
if [ "$OS" = "Darwin" ]; then
Expand All @@ -200,15 +200,15 @@ setup_shell() {
fi
ensure_containing_dir_exists "$CONF_FILE"
echo "Installing for Bash. Appending the following to $CONF_FILE:"
echo ""
echo ' # fnm'
echo ' export PATH="'"$INSTALL_DIR"':$PATH"'
echo ' eval "`fnm env`"'

echo '' >>$CONF_FILE
echo '# fnm' >>$CONF_FILE
echo 'export PATH="'"$INSTALL_DIR"':$PATH"' >>$CONF_FILE
echo 'eval "`fnm env`"' >>$CONF_FILE
{
echo ''
echo '# fnm'
echo 'FNM_PATH="'"$INSTALL_DIR"'"'
echo 'if [ -d "$FNM_PATH" ]; then'
echo ' export PATH="$FNM_PATH:$PATH"'
echo ' eval "`fnm env`"'
echo 'fi'
} | tee -a "$CONF_FILE"

else
echo "Could not infer shell type. Please set up manually."
Expand Down
Loading