feat(install): rename old manual binaries to .bak after Homebrew install#8
feat(install): rename old manual binaries to .bak after Homebrew install#8
Conversation
When migrating from manual install to Homebrew, rename existing ~/.shelltime/bin/shelltime and shelltime-daemon with .bak suffix so the shell resolves to the Homebrew-managed version instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
PR Review: feat(install): rename old manual binaries to .bak after Homebrew install Overall, this is a well-targeted fix for a real migration problem. The approach is straightforward and the implementation is mostly solid. A few items worth considering. No error handling on If if [ -f "$HOME/.shelltime/bin/shelltime" ]; then
if mv "$HOME/.shelltime/bin/shelltime" "$HOME/.shelltime/bin/shelltime.bak"; then
echo "Renamed shelltime to shelltime.bak (now using Homebrew version)"
else
echo "Warning: Failed to rename shelltime -- old binary may shadow the Homebrew version"
fi
fiIdempotency Re-running after a successful Homebrew install is safe — the User clarity The Observation: Worth noting for context: the manual install path (lines 145–150) already installs the daemon binary as Summary
The change is small, purposeful, and addresses a real user pain point. Adding error handling on the |
There was a problem hiding this comment.
Code Review
This pull request updates the installation script to rename existing manual-install binaries to backup files upon a successful Homebrew installation. The review feedback suggests using the force flag with the move command to prevent interactive prompts and recommends verifying the success of the move operation before printing confirmation messages.
| mv "$HOME/.shelltime/bin/shelltime" "$HOME/.shelltime/bin/shelltime.bak" | ||
| echo "Renamed ~/.shelltime/bin/shelltime to shelltime.bak (now using Homebrew version)" |
There was a problem hiding this comment.
Use mv -f to ensure the command does not prompt for confirmation (e.g., if the user has an alias like mv -i) and wrap it in an if block to only print the success message if the operation actually succeeds.
| mv "$HOME/.shelltime/bin/shelltime" "$HOME/.shelltime/bin/shelltime.bak" | |
| echo "Renamed ~/.shelltime/bin/shelltime to shelltime.bak (now using Homebrew version)" | |
| if mv -f "$HOME/.shelltime/bin/shelltime" "$HOME/.shelltime/bin/shelltime.bak"; then | |
| echo "Renamed ~/.shelltime/bin/shelltime to shelltime.bak (now using Homebrew version)" | |
| fi |
| mv "$HOME/.shelltime/bin/shelltime-daemon" "$HOME/.shelltime/bin/shelltime-daemon.bak" | ||
| echo "Renamed ~/.shelltime/bin/shelltime-daemon to shelltime-daemon.bak (now using Homebrew version)" |
There was a problem hiding this comment.
Use mv -f to avoid interactive prompts and only print the success message if the command succeeds.
| mv "$HOME/.shelltime/bin/shelltime-daemon" "$HOME/.shelltime/bin/shelltime-daemon.bak" | |
| echo "Renamed ~/.shelltime/bin/shelltime-daemon to shelltime-daemon.bak (now using Homebrew version)" | |
| if mv -f "$HOME/.shelltime/bin/shelltime-daemon" "$HOME/.shelltime/bin/shelltime-daemon.bak"; then | |
| echo "Renamed ~/.shelltime/bin/shelltime-daemon to shelltime-daemon.bak (now using Homebrew version)" | |
| fi |
When migrating from manual install to Homebrew, rename existing ~/.shelltime/bin/shelltime and shelltime-daemon with .bak suffix so the shell resolves to the Homebrew-managed version instead.