From b9760573bc022b21202faedd2ce6e9cacb566730 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Fri, 21 Nov 2025 10:44:36 +0800 Subject: [PATCH] Empty line normalization --- bin/clean.sh | 4 +--- bin/optimize.sh | 3 ++- bin/uninstall.sh | 14 +++++++++----- mole | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/bin/clean.sh b/bin/clean.sh index fd7ccb2..ffed92c 100755 --- a/bin/clean.sh +++ b/bin/clean.sh @@ -486,14 +486,13 @@ start_cleanup() { clear printf '\n' echo -e "${PURPLE}Clean Your Mac${NC}" + echo "" if [[ "$DRY_RUN" != "true" && -t 0 ]]; then - echo "" echo -e "${YELLOW}☻${NC} First time? Run ${GRAY}mo clean --dry-run${NC} first to preview changes" fi if [[ "$DRY_RUN" == "true" ]]; then - echo "" echo -e "${YELLOW}Dry Run Mode${NC} - Preview only, no deletions" echo "" SYSTEM_CLEAN=false @@ -501,7 +500,6 @@ start_cleanup() { fi if [[ -t 0 ]]; then - echo "" echo -ne "${PURPLE}${ICON_ARROW}${NC} System caches need sudo — ${GREEN}Enter${NC} continue, ${GRAY}Space${NC} skip: " # Use read_key to properly handle all key inputs diff --git a/bin/optimize.sh b/bin/optimize.sh index 66effaa..3d5ce0b 100755 --- a/bin/optimize.sh +++ b/bin/optimize.sh @@ -10,8 +10,9 @@ source "$SCRIPT_DIR/lib/optimize_health.sh" # Colors and icons from common.sh print_header() { - echo "" + printf '\n' echo -e "${PURPLE}Optimize Your Mac${NC}" + echo "" } show_system_health() { diff --git a/bin/uninstall.sh b/bin/uninstall.sh index 456bf20..376bfcf 100755 --- a/bin/uninstall.sh +++ b/bin/uninstall.sh @@ -690,19 +690,24 @@ main() { unset MOLE_ALT_SCREEN_ACTIVE unset MOLE_INLINE_LOADING MOLE_MANAGED_ALT_SCREEN fi + show_cursor + clear_screen + printf '\033[2J\033[H' >&2 # Also clear stderr rm -f "$apps_file" return 0 fi + # Always clear on exit from selection, regardless of alt screen state if [[ "${MOLE_ALT_SCREEN_ACTIVE:-}" == "1" ]]; then leave_alt_screen unset MOLE_ALT_SCREEN_ACTIVE unset MOLE_INLINE_LOADING MOLE_MANAGED_ALT_SCREEN fi - # Restore cursor and show a concise summary before confirmation + # Restore cursor and clear screen (output to both stdout and stderr for reliability) show_cursor - clear + clear_screen + printf '\033[2J\033[H' >&2 # Also clear stderr in case of mixed output local selection_count=${#selected_apps[@]} if [[ $selection_count -eq 0 ]]; then echo "No apps selected" @@ -717,7 +722,7 @@ main() { local name_trunc_limit=30 for selected_app in "${selected_apps[@]}"; do - IFS='|' read -r epoch app_path app_name bundle_id size last_used <<< "$selected_app" + IFS='|' read -r epoch app_path app_name bundle_id size last_used size_kb <<< "$selected_app" local display_name="$app_name" if [[ ${#display_name} -gt $name_trunc_limit ]]; then @@ -743,10 +748,9 @@ main() { local index=1 for row in "${summary_rows[@]}"; do IFS='|' read -r name_cell size_cell last_cell <<< "$row" - printf " %2d. %-*s %*s | Last: %s\n" "$index" "$max_name_width" "$name_cell" "$max_size_width" "$size_cell" "$last_cell" + printf "%d. %-*s %*s | Last: %s\n" "$index" "$max_name_width" "$name_cell" "$max_size_width" "$size_cell" "$last_cell" ((index++)) done - echo "" # Execute batch uninstallation (handles confirmation) batch_uninstall_applications diff --git a/mole b/mole index 4c01a4f..882cfb6 100755 --- a/mole +++ b/mole @@ -22,7 +22,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "$SCRIPT_DIR/lib/common.sh" # Version info -VERSION="1.9.19" +VERSION="1.9.20" MOLE_TAGLINE="can dig deep to clean your Mac." # Get latest version from remote repository