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
9 changes: 9 additions & 0 deletions install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ if [[ "$OS" == "Darwin" ]] && command_exists brew; then
if brew install shelltime/tap/shelltime; then
BREW_INSTALLED=true
echo "Successfully installed shelltime via Homebrew."
# Rename old manual-install binaries so the system uses the Homebrew version
if [ -f "$HOME/.shelltime/bin/shelltime" ]; then
mv "$HOME/.shelltime/bin/shelltime" "$HOME/.shelltime/bin/shelltime.bak"
echo "Renamed ~/.shelltime/bin/shelltime to shelltime.bak (now using Homebrew version)"
Comment on lines +29 to +30
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

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.

Suggested change
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

fi
if [ -f "$HOME/.shelltime/bin/shelltime-daemon" ]; then
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)"
Comment on lines +33 to +34
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Use mv -f to avoid interactive prompts and only print the success message if the command succeeds.

Suggested change
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

fi
else
echo "Homebrew installation failed. Falling back to manual installation..."
fi
Expand Down
Loading