1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 15:39:42 +00:00

Empty line normalization

This commit is contained in:
Tw93
2025-11-21 10:44:36 +08:00
parent 7ef786a9e2
commit b9760573bc
4 changed files with 13 additions and 10 deletions

View File

@@ -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

View File

@@ -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() {

View File

@@ -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

2
mole
View File

@@ -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