1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-17 03:59:11 +00:00

chore: auto format code

This commit is contained in:
Tw93
2025-12-17 12:36:26 +00:00
parent 34bdd14a6f
commit 611254848d
2 changed files with 30 additions and 30 deletions

View File

@@ -86,13 +86,13 @@ perform_purge() {
# Read stats
if [[ -f "$SCRIPT_DIR/../.mole_cleanup_stats" ]]; then
total_size_cleaned=$(cat "$SCRIPT_DIR/../.mole_cleanup_stats" 2>/dev/null || echo "0")
total_size_cleaned=$(cat "$SCRIPT_DIR/../.mole_cleanup_stats" 2> /dev/null || echo "0")
rm -f "$SCRIPT_DIR/../.mole_cleanup_stats"
fi
# Read count
if [[ -f "$SCRIPT_DIR/../.mole_cleanup_count" ]]; then
total_items_cleaned=$(cat "$SCRIPT_DIR/../.mole_cleanup_count" 2>/dev/null || echo "0")
total_items_cleaned=$(cat "$SCRIPT_DIR/../.mole_cleanup_count" 2> /dev/null || echo "0")
rm -f "$SCRIPT_DIR/../.mole_cleanup_count"
fi

View File

@@ -97,7 +97,7 @@ scan_purge_targets() {
done
# Run fd command
fd "${fd_args[@]}" . "$search_path" 2>/dev/null | while IFS= read -r item; do
fd "${fd_args[@]}" . "$search_path" 2> /dev/null | while IFS= read -r item; do
if is_safe_project_artifact "$item" "$search_path"; then
echo "$item"
fi
@@ -153,7 +153,7 @@ scan_purge_targets() {
done
command find "$search_path" -mindepth 2 -maxdepth 5 -type d \
\( "${find_expr[@]}" \) 2>/dev/null | while IFS= read -r item; do
\( "${find_expr[@]}" \) 2> /dev/null | while IFS= read -r item; do
if is_safe_project_artifact "$item" "$search_path"; then
echo "$item"
@@ -195,7 +195,7 @@ is_recently_modified() {
# Check modification time (macOS compatible)
local mod_time
mod_time=$(stat -f "%m" "$path" 2>/dev/null || stat -c "%Y" "$path" 2>/dev/null || echo "0")
mod_time=$(stat -f "%m" "$path" 2> /dev/null || stat -c "%Y" "$path" 2> /dev/null || echo "0")
local current_time=$(date +%s)
local age_seconds=$((current_time - mod_time))
local age_in_days=$((age_seconds / 86400))
@@ -212,7 +212,7 @@ is_recently_modified() {
get_dir_size_kb() {
local path="$1"
if [[ -d "$path" ]]; then
du -sk "$path" 2>/dev/null | awk '{print $1}' || echo "0"
du -sk "$path" 2> /dev/null | awk '{print $1}' || echo "0"
else
echo "0"
fi
@@ -252,12 +252,12 @@ safe_clean() {
local original_prefix="${MOLE_SPINNER_PREFIX:-}"
MOLE_SPINNER_PREFIX="" start_inline_spinner "Cleaning $description (~${size_mb}MB)..."
rm -rf "$path" 2>/dev/null || true
rm -rf "$path" 2> /dev/null || true
stop_inline_spinner
MOLE_SPINNER_PREFIX="$original_prefix"
else
rm -rf "$path" 2>/dev/null || true
rm -rf "$path" 2> /dev/null || true
fi
if [[ ! -e "$path" ]]; then
@@ -326,11 +326,11 @@ clean_project_artifacts() {
cleanup_scan() {
# Kill all background scans
for pid in "${scan_pids[@]}"; do
kill "$pid" 2>/dev/null || true
kill "$pid" 2> /dev/null || true
done
# Clean up temp files
for temp in "${scan_temps[@]}"; do
rm -f "$temp" 2>/dev/null || true
rm -f "$temp" 2> /dev/null || true
done
if [[ -t 1 ]]; then
stop_inline_spinner
@@ -363,7 +363,7 @@ clean_project_artifacts() {
# Wait for all scans to complete
for pid in "${scan_pids[@]}"; do
wait "$pid" 2>/dev/null || true
wait "$pid" 2> /dev/null || true
done
if [[ -t 1 ]]; then