1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 12:06:45 +00:00

🐛 Normalize output tags

This commit is contained in:
Tw93
2025-10-05 22:16:25 +08:00
parent 79b1f53c7a
commit 3ff933f5d5
8 changed files with 154 additions and 125 deletions

View File

@@ -85,7 +85,7 @@ resolve_source_dir() {
# Expand tmp now so trap doesn't depend on local scope
trap "rm -rf '$tmp'" EXIT
echo "Fetching Mole source..."
echo -e "${BLUE}${NC} Fetching Mole source..."
if command -v curl >/dev/null 2>&1; then
# Download main branch tarball
if curl -fsSL -o "$tmp/mole.tar.gz" "https://github.com/tw93/mole/archive/refs/heads/main.tar.gz"; then
@@ -448,17 +448,17 @@ perform_update() {
update_via_homebrew "$VERSION"
else
# Fallback: inline implementation
echo -e "${BLUE}${NC} Updating Homebrew..."
echo -e "${BLUE}${NC} Updating Homebrew..."
brew update 2>&1 | grep -Ev "^(==>|Already up-to-date)" || true
echo -e "${BLUE}${NC} Upgrading Mole..."
echo -e "${BLUE}${NC} Upgrading Mole..."
local upgrade_output
upgrade_output=$(brew upgrade mole 2>&1) || true
if echo "$upgrade_output" | grep -q "already installed"; then
local current_version
current_version=$(brew list --versions mole 2>/dev/null | awk '{print $2}')
echo -e "${GREEN}${NC} Already on latest version (${current_version:-$VERSION})"
echo -e "${BLUE}${NC} Already on latest version (${current_version:-$VERSION})"
elif echo "$upgrade_output" | grep -q "Error:"; then
log_error "Homebrew upgrade failed"
echo "$upgrade_output" | grep "Error:" >&2
@@ -467,7 +467,7 @@ perform_update() {
echo "$upgrade_output" | grep -Ev "^(==>|Updating Homebrew|Warning:)" || true
local new_version
new_version=$(brew list --versions mole 2>/dev/null | awk '{print $2}')
echo -e "${GREEN}${NC} Updated to latest version (${new_version:-$VERSION})"
echo -e "${BLUE}${NC} Updated to latest version (${new_version:-$VERSION})"
fi
rm -f "$HOME/.cache/mole/version_check" "$HOME/.cache/mole/update_message"
@@ -494,7 +494,7 @@ perform_update() {
fi
if [[ "$installed_version" == "$target_version" ]]; then
echo -e "${GREEN}${NC} Already on latest version ($installed_version)"
echo -e "${BLUE}${NC} Already on latest version ($installed_version)"
exit 0
fi
@@ -514,7 +514,7 @@ perform_update() {
updated_version="$target_version"
fi
echo -e "${GREEN}${NC} Updated to latest version ($updated_version)"
echo -e "${BLUE}${NC} Updated to latest version ($updated_version)"
}
# Run requested action