From 45a8671e4b9ec6a438418097b12375726a57ac04 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Thu, 11 Jun 2026 20:03:56 +0000 Subject: [PATCH] fix: print PATH setup instructions when install dir is not in PATH --- install.sh | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index de53e43..0c35fc6 100755 --- a/install.sh +++ b/install.sh @@ -85,5 +85,36 @@ install -m 0755 "$tmp/boo" "$install_dir/boo" log "Installed $("$install_dir/boo" -V 2>&1) to $install_dir/boo" case ":$PATH:" in *":$install_dir:"*) ;; -*) log "warning: $install_dir is not in your PATH" ;; +*) + # Reference the directory via $HOME where possible so the + # suggested rc line survives a home directory move. + dir_ref=$install_dir + case "$install_dir" in + "$HOME"/*) dir_ref="\$HOME${install_dir#"$HOME"}" ;; + esac + log "" + log "warning: $install_dir is not in your PATH" + case "$(basename "${SHELL:-sh}")" in + zsh) + log "To add it, run:" + log " echo 'export PATH=\"$dir_ref:\$PATH\"' >> ~/.zshrc" + log "then restart your shell." + ;; + bash) + log "To add it, run:" + log " echo 'export PATH=\"$dir_ref:\$PATH\"' >> ~/.bashrc" + log "then restart your shell." + ;; + fish) + log "To add it, run:" + log " fish_add_path \"$install_dir\"" + ;; + *) + log "Add it to your shell's PATH to run boo by name." + ;; + esac + log "" + log "For a system-wide install instead, rerun with:" + log " curl -fsSL https://raw.githubusercontent.com/coder/boo/main/install.sh | sudo BOO_INSTALL_DIR=/usr/local/bin sh" + ;; esac