1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-22 17:55:08 +00:00

fix(clean): respect whitelist in Homebrew dry-run mode

Show "skipped whitelist" instead of "would cleanup" when Homebrew cache
is whitelisted, making dry-run behavior consistent with actual execution.
This commit is contained in:
tw93
2026-02-28 14:57:44 +08:00
parent 167bc7ac8d
commit 60624f951b

View File

@@ -5,7 +5,12 @@
clean_homebrew() {
command -v brew > /dev/null 2>&1 || return 0
if [[ "${DRY_RUN:-false}" == "true" ]]; then
echo -e " ${YELLOW}${ICON_DRY_RUN}${NC} Homebrew · would cleanup and autoremove"
# Check if Homebrew cache is whitelisted
if is_path_whitelisted "$HOME/Library/Caches/Homebrew"; then
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Homebrew · skipped whitelist"
else
echo -e " ${YELLOW}${ICON_DRY_RUN}${NC} Homebrew · would cleanup and autoremove"
fi
return 0
fi
# Skip if cleaned recently to avoid repeated heavy operations.