mirror of
https://github.com/oven-sh/bun
synced 2026-02-15 21:32:05 +00:00
[install] Auto-set PATH if possible
This commit is contained in:
@@ -11,6 +11,8 @@ Green=''
|
||||
BWhite=''
|
||||
BGreen=''
|
||||
|
||||
Dim='' # White
|
||||
|
||||
if test -t 1; then
|
||||
# Reset
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
@@ -20,6 +22,8 @@ if test -t 1; then
|
||||
Green='\033[0;32m' # Green
|
||||
White='\033[0;37m' # White
|
||||
|
||||
Dim='\033[0;2m' # White
|
||||
|
||||
# Bold
|
||||
BGreen='\033[1;32m' # Green
|
||||
BWhite='\033[1;37m' # White
|
||||
@@ -99,17 +103,24 @@ fi
|
||||
if test $(basename $SHELL) == "fish"; then
|
||||
# Install completions, but we don't care if it fails
|
||||
IS_BUN_AUTO_UPDATE="true" SHELL="fish" $exe completions >/dev/null 2>&1
|
||||
if test -f $HOME/.config/fish; then
|
||||
echo -e "\nset -Ux BUN_INSTALL \"$bun_install\"\n" >>"$HOME/.config/fish"
|
||||
echo -e "\nset -px --path PATH \"$bin_dir\"\n" >>"$HOME/.config/fish"
|
||||
if test -f $HOME/.config/fish/config.fish; then
|
||||
echo -e "\n# Bun\nset -Ux BUN_INSTALL \"$bun_install\"" >>"$HOME/.config/fish/config.fish"
|
||||
echo -e "set -px --path PATH \"$bin_dir\"\n" >>"$HOME/.config/fish/config.fish"
|
||||
echo ""
|
||||
echo -e "$BWhite Added \"$bin_dir\" to PATH in \"$HOME/.config/fish\"$Color_Off"
|
||||
echo -e "$Dim Added \"$bin_dir\" to \$PATH in \"\~/.config/fish/config.fish\"$Color_Off"
|
||||
echo ""
|
||||
echo -e "To get started, run"
|
||||
echo -e "$BWhite"
|
||||
echo -e " source ~/.config/fish/config.fish"
|
||||
echo -e " bun --help$Color_Off"
|
||||
exit 0
|
||||
else
|
||||
echo ""
|
||||
echo "Manually add the directory to your \$HOME/.config/fish"
|
||||
echo "Manually add the directory to your \$HOME/.config/fish/config.fish (or similar)"
|
||||
echo ""
|
||||
echo -e " $BWhite set -Ux BUN_INSTALL \"$bun_install\"$Color_Off"
|
||||
echo -e " $BWhite set -px --path PATH \"$bin_dir\"$Color_Off"
|
||||
echo ""
|
||||
fi
|
||||
elif
|
||||
test $(basename $SHELL) == "zsh"
|
||||
@@ -118,10 +129,18 @@ then
|
||||
IS_BUN_AUTO_UPDATE="true" SHELL="zsh" $exe completions >/dev/null 2>&1
|
||||
|
||||
if test -f $HOME/.zshrc; then
|
||||
echo -e "export BUN_INSTALL=\"$bun_install\"" >>"$HOME/.zshrc"
|
||||
echo -e "\n# Bun\nexport BUN_INSTALL=\"$bun_install\"" >>"$HOME/.zshrc"
|
||||
echo -e "export PATH=\"\$BUN_INSTALL/bin:\$PATH\"" >>"$HOME/.zshrc"
|
||||
echo ""
|
||||
echo -e "$BWhite Added \"$bin_dir\" to PATH in \"$HOME/.zshrc\"$Color_Off"
|
||||
echo -e "$Dim Added \"$bin_dir\" to \$PATH in \"~/.zshrc\"$Color_Off"
|
||||
|
||||
echo ""
|
||||
echo -e "To get started, run"
|
||||
echo -e "$BWhite"
|
||||
echo -e " exec $SHELL"
|
||||
echo -e " bun --help$Color_Off"
|
||||
echo ""
|
||||
exit 0
|
||||
else
|
||||
echo ""
|
||||
echo "Manually add the directory to your \$HOME/.zshrc (or similar)"
|
||||
|
||||
Reference in New Issue
Block a user