mirror of
https://github.com/tw93/Mole.git
synced 2026-02-11 03:39:16 +00:00
feat: improve version detection and error handling
- Add fallback to mo --version when brew list fails - Add error handling for debug log write failures - Improve version extraction with multiple fallback strategies
This commit is contained in:
@@ -79,6 +79,7 @@ update_via_homebrew() {
|
||||
if echo "$upgrade_output" | grep -q "already installed"; then
|
||||
local installed_version
|
||||
installed_version=$(brew list --versions mole 2> /dev/null | awk '{print $2}')
|
||||
[[ -z "$installed_version" ]] && installed_version=$(mo --version 2> /dev/null | awk '/Mole version/ {print $3; exit}')
|
||||
echo ""
|
||||
echo -e "${GREEN}${ICON_SUCCESS}${NC} Already on latest version (${installed_version:-$current_version})"
|
||||
echo ""
|
||||
@@ -90,6 +91,7 @@ update_via_homebrew() {
|
||||
echo "$upgrade_output" | grep -Ev "^(==>|Updating Homebrew|Warning:)" || true
|
||||
local new_version
|
||||
new_version=$(brew list --versions mole 2> /dev/null | awk '{print $2}')
|
||||
[[ -z "$new_version" ]] && new_version=$(mo --version 2> /dev/null | awk '/Mole version/ {print $3; exit}')
|
||||
echo ""
|
||||
echo -e "${GREEN}${ICON_SUCCESS}${NC} Updated to latest version (${new_version:-$current_version})"
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user