fix: show PowerShell PATH instructions for Windows users (#4989)

Signed-off-by: prempyla <pylaprem@gmail.com>
This commit is contained in:
prempyla
2025-10-05 02:45:19 +05:30
committed by GitHub
parent 9741718a09
commit 51651550e0
+49 -3
View File
@@ -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"
echo "or rerun this install script after updating your PATH."
else
SHELL_NAME=$(basename "$SHELL")
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