mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 11:31:46 +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:
8
mole
8
mole
@@ -346,7 +346,13 @@ update_mole() {
|
||||
|
||||
if ! printf '%s\n' "$output" | grep -Eq "Updated to latest version|Already on latest version"; then
|
||||
local new_version
|
||||
new_version=$("$mole_path" --version 2> /dev/null | awk 'NR==1 && NF {print $NF}' || echo "")
|
||||
new_version=$(printf '%s\n' "$output" | sed -n 's/.*(\([^)]*\)).*/\1/p' | head -1)
|
||||
if [[ -z "$new_version" ]]; then
|
||||
new_version=$("$mole_path" --version 2> /dev/null | awk 'NR==1 && NF {print $NF}' || echo "")
|
||||
fi
|
||||
if [[ -z "$new_version" ]]; then
|
||||
new_version="$latest"
|
||||
fi
|
||||
printf '\n%s\n\n' "${GREEN}${ICON_SUCCESS}${NC} Updated to latest version (${new_version:-unknown})"
|
||||
else
|
||||
printf '\n'
|
||||
|
||||
Reference in New Issue
Block a user