Skip to content
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
52 changes: 49 additions & 3 deletions download_cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,58 @@ else
echo "Skipping 'goose configure', you may need to run this manually later"
fi



# --- 7) Check PATH and give instructions if needed ---
if [[ ":$PATH:" != *":$GOOSE_BIN_DIR:"* ]]; then
echo ""
echo "Warning: goose installed, but $GOOSE_BIN_DIR is not in your PATH."
echo "Add it to your PATH by editing ~/.bashrc, ~/.zshrc, or similar:"
echo " export PATH=\"$GOOSE_BIN_DIR:\$PATH\""
echo "Then reload your shell (e.g. 'source ~/.bashrc', 'source ~/.zshrc') to apply changes."

if [ "$OS" = "windows" ]; then
echo "To add goose to your PATH in PowerShell:"
echo ""
echo "# Add to your PowerShell profile"
echo '$profilePath = $PROFILE'
echo 'if (!(Test-Path $profilePath)) { New-Item -Path $profilePath -ItemType File -Force }'
echo 'Add-Content -Path $profilePath -Value ''$env:PATH = "$env:USERPROFILE\.local\bin;$env:PATH"'''
echo "# Reload profile or restart PowerShell"
echo '. $PROFILE'
echo ""
echo "Alternatively, you can run:"
echo " goose configure"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last comment here -- you're presenting this 'alternative' on line 256 and 264 almost like it's something they can do INSTEAD of modifying their path? How does running 'goose configure' help set up their PATH on their behalf if this download script couldn't do it?

I kinda feel like we could get more intelligent here, where we just prompt the user "hey do you want me to add the goose installation folder to your PATH environment" and just go run these commands or a an echo "export PATH=/goose/bin/etc:$PATH" >> ~/.bashrc because we could determine from $SHELL which shell they're using on a Mac/Linux system.

maybe something like:

The $GOOSE_BIN_DIR is not in your path, what would you like to do:

  1. Add it for me
  2. I'll add it myself, give me instructions

and then if they're on Linux/Mac we could prompt them regardless of their choice:

We think you're using $SHELL, should we add it to ~/.$(basename $SHELL)rc for you?

echo "or rerun this install script after updating your PATH."
else
SHELL_NAME=$(basename "$SHELL")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scope expanded a bit on this PR and feels like one we'd want to now test a bit on different envs/shells to make sure there are no hitches.

Either that or we go back to only adding the improvement for windows, which I think was great as it was after iterations with @iandouglas !


echo ""
echo "The \$GOOSE_BIN_DIR is not in your PATH."
echo "What would you like to do?"
echo "1) Add it for me"
echo "2) I'll add it myself, show instructions"

read -p "Enter choice [1/2]: " choice

case "$choice" in
1)
RC_FILE="$HOME/.${SHELL_NAME}rc"
echo "Adding \$GOOSE_BIN_DIR to $RC_FILE..."
echo "export PATH=\"$GOOSE_BIN_DIR:\$PATH\"" >> "$RC_FILE"
echo "Done! Reload your shell or run 'source $RC_FILE' to apply changes."
;;
2)
echo ""
echo "Add it to your PATH by editing ~/.${SHELL_NAME}rc or similar:"
echo " export PATH=\"$GOOSE_BIN_DIR:\$PATH\""
echo "Then reload your shell (e.g. 'source ~/.${SHELL_NAME}rc') to apply changes."
;;
*)
echo "Invalid choice. Please add \$GOOSE_BIN_DIR to your PATH manually."
;;
esac
fi

echo ""
fi



Loading