aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-11-01 03:59:36 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-11-01 03:59:36 -0700
commit83e553d6a9f43bab9d03e1deaba4df804954ffb5 (patch)
treea59ce5f04be6d1f5cc00befd8fb4c51f2d8676bb /src
parent173724b4020cae1f0caacb5116a31aec86f2c2db (diff)
downloadbun-83e553d6a9f43bab9d03e1deaba4df804954ffb5.tar.gz
bun-83e553d6a9f43bab9d03e1deaba4df804954ffb5.tar.zst
bun-83e553d6a9f43bab9d03e1deaba4df804954ffb5.zip
[install] Auto-set PATH if possible
Diffstat (limited to 'src')
-rw-r--r--src/cli/install.sh33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/cli/install.sh b/src/cli/install.sh
index e49d69f64..80721963b 100644
--- a/src/cli/install.sh
+++ b/src/cli/install.sh
@@ -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)"