1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-22 19:40:07 +00:00

feat(clean): add storage clues after large files

This commit is contained in:
tw93
2026-02-23 11:34:04 +08:00
parent 1169cbf198
commit 3112673ed3
4 changed files with 448 additions and 6 deletions

View File

@@ -410,7 +410,8 @@ clean_local_snapshots() {
local snapshot_count
snapshot_count=$(echo "$snapshot_list" | { grep -Eo 'com\.apple\.TimeMachine\.[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{6}' || true; } | wc -l | awk '{print $1}')
if [[ "$snapshot_count" =~ ^[0-9]+$ && "$snapshot_count" -gt 0 ]]; then
echo -e " ${YELLOW}${ICON_WARNING}${NC} Time Machine local snapshots: ${GREEN}${snapshot_count}${NC}${GRAY}, Review: tmutil listlocalsnapshots /${NC}"
echo -e " ${YELLOW}${ICON_WARNING}${NC} Time Machine local snapshots: ${GREEN}${snapshot_count}${NC}"
echo -e " ${GRAY}${ICON_REVIEW}${NC} ${GRAY}Review: tmutil listlocalsnapshots /${NC}"
note_activity
fi
}

View File

@@ -887,7 +887,8 @@ check_large_file_candidates() {
if [[ -n "$snapshot_list" ]]; then
snapshot_count=$(echo "$snapshot_list" | { grep -Eo 'com\.apple\.TimeMachine\.[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{6}' || true; } | wc -l | awk '{print $1}')
if [[ "$snapshot_count" =~ ^[0-9]+$ && "$snapshot_count" -gt 0 ]]; then
echo -e " ${YELLOW}${ICON_WARNING}${NC} Time Machine local snapshots: ${GREEN}${snapshot_count}${NC}${GRAY}, Review: tmutil listlocalsnapshots /${NC}"
echo -e " ${YELLOW}${ICON_WARNING}${NC} Time Machine local snapshots: ${GREEN}${snapshot_count}${NC}"
echo -e " ${GRAY}${ICON_REVIEW}${NC} ${GRAY}Review: tmutil listlocalsnapshots /${NC}"
found_any=true
fi
fi
@@ -900,14 +901,14 @@ check_large_file_candidates() {
echo -e " ${YELLOW}${ICON_WARNING}${NC} Docker storage:"
while IFS=$'\t' read -r dtype dsize dreclaim; do
[[ -z "$dtype" ]] && continue
echo -e " ${GRAY} $dtype: $dsize, Reclaimable: $dreclaim${NC}"
echo -e " ${GRAY}${ICON_LIST} $dtype: $dsize, Reclaimable: $dreclaim${NC}"
done <<< "$docker_output"
found_any=true
else
docker_output=$(run_with_timeout 3 docker system df 2> /dev/null || true)
if [[ -n "$docker_output" ]]; then
echo -e " ${YELLOW}${ICON_WARNING}${NC} Docker storage:"
echo -e " ${GRAY}Run: docker system df${NC}"
echo -e " ${GRAY}${ICON_REVIEW}${NC} ${GRAY}Run: docker system df${NC}"
found_any=true
fi
fi

View File

@@ -35,8 +35,10 @@ readonly ICON_WARNING="◎"
readonly ICON_EMPTY="○"
readonly ICON_SOLID="●"
readonly ICON_LIST="•"
readonly ICON_SUBLIST="↳"
readonly ICON_ARROW="➤"
readonly ICON_DRY_RUN="→"
readonly ICON_REVIEW="☞"
readonly ICON_NAV_UP="↑"
readonly ICON_NAV_DOWN="↓"