mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 17:24:45 +00:00
Overall repair exception situation
This commit is contained in:
BIN
bin/analyze-go
BIN
bin/analyze-go
Binary file not shown.
51
bin/clean.sh
51
bin/clean.sh
@@ -403,11 +403,12 @@ clean_ds_store_tree() {
|
|||||||
-path "*/Library/Caches" -prune -o
|
-path "*/Library/Caches" -prune -o
|
||||||
)
|
)
|
||||||
|
|
||||||
# Limit depth for HOME to avoid slow scans
|
# Build find command to avoid unbound array expansion with set -u
|
||||||
local -a max_depth=()
|
local -a find_cmd=("find" "$target")
|
||||||
if [[ "$target" == "$HOME" ]]; then
|
if [[ "$target" == "$HOME" ]]; then
|
||||||
max_depth=(-maxdepth 5)
|
find_cmd+=("-maxdepth" "5")
|
||||||
fi
|
fi
|
||||||
|
find_cmd+=("${exclude_paths[@]}" "-type" "f" "-name" ".DS_Store" "-print0")
|
||||||
|
|
||||||
# Find .DS_Store files with exclusions and depth limit
|
# Find .DS_Store files with exclusions and depth limit
|
||||||
while IFS= read -r -d '' ds_file; do
|
while IFS= read -r -d '' ds_file; do
|
||||||
@@ -423,7 +424,7 @@ clean_ds_store_tree() {
|
|||||||
if [[ $file_count -ge 500 ]]; then
|
if [[ $file_count -ge 500 ]]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done < <(find "$target" "${max_depth[@]}" "${exclude_paths[@]}" -type f -name '.DS_Store' -print0 2> /dev/null)
|
done < <("${find_cmd[@]}" 2> /dev/null)
|
||||||
|
|
||||||
if [[ "$spinner_active" == "true" ]]; then
|
if [[ "$spinner_active" == "true" ]]; then
|
||||||
stop_inline_spinner
|
stop_inline_spinner
|
||||||
@@ -941,24 +942,42 @@ perform_cleanup() {
|
|||||||
|
|
||||||
# Clean project build caches in home directory (safe - can be rebuilt)
|
# Clean project build caches in home directory (safe - can be rebuilt)
|
||||||
# Find .next/cache directories (limit depth to avoid slow scans)
|
# Find .next/cache directories (limit depth to avoid slow scans)
|
||||||
find "$HOME" -type d -name ".next" -maxdepth 4 \
|
if [[ -t 1 ]]; then
|
||||||
-not -path "*/Library/*" \
|
MOLE_SPINNER_PREFIX=" "
|
||||||
-not -path "*/.Trash/*" \
|
start_inline_spinner "Searching Next.js caches..."
|
||||||
-not -path "*/node_modules/*" \
|
fi
|
||||||
2>/dev/null | while read -r next_dir; do
|
while IFS= read -r next_dir; do
|
||||||
if [[ -d "$next_dir/cache" ]]; then
|
if [[ -d "$next_dir/cache" ]]; then
|
||||||
safe_clean "$next_dir/cache"/* "Next.js build cache" || true
|
safe_clean "$next_dir/cache"/* "Next.js build cache" || true
|
||||||
fi
|
fi
|
||||||
done
|
done < <(
|
||||||
|
find "$HOME" -type d -name ".next" -maxdepth 4 \
|
||||||
|
-not -path "*/Library/*" \
|
||||||
|
-not -path "*/.Trash/*" \
|
||||||
|
-not -path "*/node_modules/*" \
|
||||||
|
2>/dev/null || true
|
||||||
|
)
|
||||||
|
if [[ -t 1 ]]; then
|
||||||
|
stop_inline_spinner
|
||||||
|
fi
|
||||||
|
|
||||||
# Clean Python bytecode cache (limit depth to avoid slow scans)
|
# Clean Python bytecode cache (limit depth to avoid slow scans)
|
||||||
find "$HOME" -type d -name "__pycache__" -maxdepth 5 \
|
if [[ -t 1 ]]; then
|
||||||
-not -path "*/Library/*" \
|
MOLE_SPINNER_PREFIX=" "
|
||||||
-not -path "*/.Trash/*" \
|
start_inline_spinner "Searching Python caches..."
|
||||||
-not -path "*/node_modules/*" \
|
fi
|
||||||
2>/dev/null | while read -r pycache; do
|
while IFS= read -r pycache; do
|
||||||
safe_clean "$pycache"/* "Python bytecode cache" || true
|
safe_clean "$pycache"/* "Python bytecode cache" || true
|
||||||
done
|
done < <(
|
||||||
|
find "$HOME" -type d -name "__pycache__" -maxdepth 5 \
|
||||||
|
-not -path "*/Library/*" \
|
||||||
|
-not -path "*/.Trash/*" \
|
||||||
|
-not -path "*/node_modules/*" \
|
||||||
|
2>/dev/null || true
|
||||||
|
)
|
||||||
|
if [[ -t 1 ]]; then
|
||||||
|
stop_inline_spinner
|
||||||
|
fi
|
||||||
safe_clean ~/Library/Caches/Google/AndroidStudio*/* "Android Studio cache"
|
safe_clean ~/Library/Caches/Google/AndroidStudio*/* "Android Studio cache"
|
||||||
safe_clean ~/Library/Caches/com.unity3d.*/* "Unity cache"
|
safe_clean ~/Library/Caches/com.unity3d.*/* "Unity cache"
|
||||||
safe_clean ~/Library/Caches/com.jetbrains.toolbox/* "JetBrains Toolbox cache"
|
safe_clean ~/Library/Caches/com.jetbrains.toolbox/* "JetBrains Toolbox cache"
|
||||||
|
|||||||
@@ -934,8 +934,28 @@ func (m model) View() string {
|
|||||||
if m.isOverview {
|
if m.isOverview {
|
||||||
fmt.Fprintf(&b, "%sAnalyze Disk%s\n", colorPurple, colorReset)
|
fmt.Fprintf(&b, "%sAnalyze Disk%s\n", colorPurple, colorReset)
|
||||||
if m.overviewScanning {
|
if m.overviewScanning {
|
||||||
fmt.Fprintf(&b, "%sSelect a location to explore:%s ", colorGray, colorReset)
|
// Check if we're in initial scan (all entries are pending)
|
||||||
fmt.Fprintf(&b, "%s%s%s%s Scanning...\n", colorCyan, colorBold, spinnerFrames[m.spinner], colorReset)
|
allPending := true
|
||||||
|
for _, entry := range m.entries {
|
||||||
|
if entry.size >= 0 {
|
||||||
|
allPending = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if allPending {
|
||||||
|
// Show prominent loading screen for initial scan
|
||||||
|
fmt.Fprintf(&b, "\n%s%s%s%s Measuring disk usage across system directories...\n",
|
||||||
|
colorCyan, colorBold,
|
||||||
|
spinnerFrames[m.spinner],
|
||||||
|
colorReset)
|
||||||
|
fmt.Fprintf(&b, "%sThis may take a moment on first run%s\n", colorGray, colorReset)
|
||||||
|
return b.String()
|
||||||
|
} else {
|
||||||
|
// Progressive scanning - show subtle indicator
|
||||||
|
fmt.Fprintf(&b, "%sSelect a location to explore:%s ", colorGray, colorReset)
|
||||||
|
fmt.Fprintf(&b, "%s%s%s%s Scanning...\n", colorCyan, colorBold, spinnerFrames[m.spinner], colorReset)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(&b, "%sSelect a location to explore:%s\n", colorGray, colorReset)
|
fmt.Fprintf(&b, "%sSelect a location to explore:%s\n", colorGray, colorReset)
|
||||||
}
|
}
|
||||||
|
|||||||
2
mole
2
mole
@@ -22,7 +22,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|||||||
source "$SCRIPT_DIR/lib/common.sh"
|
source "$SCRIPT_DIR/lib/common.sh"
|
||||||
|
|
||||||
# Version info
|
# Version info
|
||||||
VERSION="1.9.2"
|
VERSION="1.9.3"
|
||||||
MOLE_TAGLINE="can dig deep to clean your Mac."
|
MOLE_TAGLINE="can dig deep to clean your Mac."
|
||||||
|
|
||||||
# Get latest version from remote repository
|
# Get latest version from remote repository
|
||||||
|
|||||||
Reference in New Issue
Block a user