mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 16:49:41 +00:00
Merge PR #231: fix(purge): use regex OR pattern for fd
This commit is contained in:
@@ -307,6 +307,10 @@ scan_purge_targets() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if command -v fd > /dev/null 2>&1; then
|
if command -v fd > /dev/null 2>&1; then
|
||||||
|
local pattern="($(
|
||||||
|
IFS='|'
|
||||||
|
echo "${PURGE_TARGETS[*]}"
|
||||||
|
))"
|
||||||
local fd_args=(
|
local fd_args=(
|
||||||
"--absolute-path"
|
"--absolute-path"
|
||||||
"--hidden"
|
"--hidden"
|
||||||
@@ -320,10 +324,7 @@ scan_purge_targets() {
|
|||||||
"--exclude" ".Trash"
|
"--exclude" ".Trash"
|
||||||
"--exclude" "Applications"
|
"--exclude" "Applications"
|
||||||
)
|
)
|
||||||
for target in "${PURGE_TARGETS[@]}"; do
|
fd "${fd_args[@]}" "$pattern" "$search_path" 2> /dev/null | while IFS= read -r item; do
|
||||||
fd_args+=("-g" "$target")
|
|
||||||
done
|
|
||||||
fd "${fd_args[@]}" . "$search_path" 2> /dev/null | while IFS= read -r item; do
|
|
||||||
if is_safe_project_artifact "$item" "$search_path"; then
|
if is_safe_project_artifact "$item" "$search_path"; then
|
||||||
echo "$item"
|
echo "$item"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user