mirror of
https://github.com/tw93/Mole.git
synced 2026-02-09 19:39:16 +00:00
fix: expand default whitelist patterns for accurate comparison and list all active patterns in dry-run output
This commit is contained in:
22
bin/clean.sh
22
bin/clean.sh
@@ -796,13 +796,15 @@ perform_cleanup() {
|
|||||||
# Show whitelist info if patterns are active
|
# Show whitelist info if patterns are active
|
||||||
if [[ ${#WHITELIST_PATTERNS[@]} -gt 0 ]]; then
|
if [[ ${#WHITELIST_PATTERNS[@]} -gt 0 ]]; then
|
||||||
# Count predefined vs custom patterns
|
# Count predefined vs custom patterns
|
||||||
|
# Note: WHITELIST_PATTERNS are already expanded, need to expand defaults for comparison
|
||||||
local predefined_count=0
|
local predefined_count=0
|
||||||
local custom_count=0
|
local custom_count=0
|
||||||
|
|
||||||
for pattern in "${WHITELIST_PATTERNS[@]}"; do
|
for pattern in "${WHITELIST_PATTERNS[@]}"; do
|
||||||
local is_predefined=false
|
local is_predefined=false
|
||||||
for default in "${DEFAULT_WHITELIST_PATTERNS[@]}"; do
|
for default in "${DEFAULT_WHITELIST_PATTERNS[@]}"; do
|
||||||
if [[ "$pattern" == "$default" ]]; then
|
local expanded_default="${default/#\~/$HOME}"
|
||||||
|
if [[ "$pattern" == "$expanded_default" ]]; then
|
||||||
is_predefined=true
|
is_predefined=true
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
@@ -825,20 +827,12 @@ perform_cleanup() {
|
|||||||
|
|
||||||
echo -e "${BLUE}${ICON_SUCCESS}${NC} Whitelist: $summary"
|
echo -e "${BLUE}${ICON_SUCCESS}${NC} Whitelist: $summary"
|
||||||
|
|
||||||
# List custom patterns for verification
|
# List all whitelist patterns in dry-run mode for verification (Issue #206)
|
||||||
if [[ $custom_count -gt 0 ]]; then
|
if [[ "$DRY_RUN" == "true" ]]; then
|
||||||
for pattern in "${WHITELIST_PATTERNS[@]}"; do
|
for pattern in "${WHITELIST_PATTERNS[@]}"; do
|
||||||
local is_custom=true
|
# Skip FINDER_METADATA sentinel
|
||||||
for default in "${DEFAULT_WHITELIST_PATTERNS[@]}"; do
|
[[ "$pattern" == "$FINDER_METADATA_SENTINEL" ]] && continue
|
||||||
if [[ "$pattern" == "$default" ]]; then
|
echo -e " ${GRAY}→ $pattern${NC}"
|
||||||
is_custom=false
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ "$is_custom" == "true" ]]; then
|
|
||||||
echo -e " ${GRAY}→ Custom: $pattern${NC}"
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user