mirror of
https://github.com/tw93/Mole.git
synced 2026-02-16 08:56:11 +00:00
chore: auto format code
This commit is contained in:
@@ -86,13 +86,13 @@ perform_purge() {
|
|||||||
|
|
||||||
# Read stats
|
# Read stats
|
||||||
if [[ -f "$SCRIPT_DIR/../.mole_cleanup_stats" ]]; then
|
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"
|
rm -f "$SCRIPT_DIR/../.mole_cleanup_stats"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Read count
|
# Read count
|
||||||
if [[ -f "$SCRIPT_DIR/../.mole_cleanup_count" ]]; then
|
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"
|
rm -f "$SCRIPT_DIR/../.mole_cleanup_count"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ scan_purge_targets() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Run fd command
|
# 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
|
if is_safe_project_artifact "$item" "$search_path"; then
|
||||||
echo "$item"
|
echo "$item"
|
||||||
fi
|
fi
|
||||||
@@ -153,7 +153,7 @@ scan_purge_targets() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
command find "$search_path" -mindepth 2 -maxdepth 5 -type d \
|
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
|
if is_safe_project_artifact "$item" "$search_path"; then
|
||||||
echo "$item"
|
echo "$item"
|
||||||
@@ -195,7 +195,7 @@ is_recently_modified() {
|
|||||||
|
|
||||||
# Check modification time (macOS compatible)
|
# Check modification time (macOS compatible)
|
||||||
local mod_time
|
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 current_time=$(date +%s)
|
||||||
local age_seconds=$((current_time - mod_time))
|
local age_seconds=$((current_time - mod_time))
|
||||||
local age_in_days=$((age_seconds / 86400))
|
local age_in_days=$((age_seconds / 86400))
|
||||||
@@ -212,7 +212,7 @@ is_recently_modified() {
|
|||||||
get_dir_size_kb() {
|
get_dir_size_kb() {
|
||||||
local path="$1"
|
local path="$1"
|
||||||
if [[ -d "$path" ]]; then
|
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
|
else
|
||||||
echo "0"
|
echo "0"
|
||||||
fi
|
fi
|
||||||
@@ -252,12 +252,12 @@ safe_clean() {
|
|||||||
local original_prefix="${MOLE_SPINNER_PREFIX:-}"
|
local original_prefix="${MOLE_SPINNER_PREFIX:-}"
|
||||||
MOLE_SPINNER_PREFIX="" start_inline_spinner "Cleaning $description (~${size_mb}MB)..."
|
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
|
stop_inline_spinner
|
||||||
MOLE_SPINNER_PREFIX="$original_prefix"
|
MOLE_SPINNER_PREFIX="$original_prefix"
|
||||||
else
|
else
|
||||||
rm -rf "$path" 2>/dev/null || true
|
rm -rf "$path" 2> /dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -e "$path" ]]; then
|
if [[ ! -e "$path" ]]; then
|
||||||
@@ -326,11 +326,11 @@ clean_project_artifacts() {
|
|||||||
cleanup_scan() {
|
cleanup_scan() {
|
||||||
# Kill all background scans
|
# Kill all background scans
|
||||||
for pid in "${scan_pids[@]}"; do
|
for pid in "${scan_pids[@]}"; do
|
||||||
kill "$pid" 2>/dev/null || true
|
kill "$pid" 2> /dev/null || true
|
||||||
done
|
done
|
||||||
# Clean up temp files
|
# Clean up temp files
|
||||||
for temp in "${scan_temps[@]}"; do
|
for temp in "${scan_temps[@]}"; do
|
||||||
rm -f "$temp" 2>/dev/null || true
|
rm -f "$temp" 2> /dev/null || true
|
||||||
done
|
done
|
||||||
if [[ -t 1 ]]; then
|
if [[ -t 1 ]]; then
|
||||||
stop_inline_spinner
|
stop_inline_spinner
|
||||||
@@ -363,7 +363,7 @@ clean_project_artifacts() {
|
|||||||
|
|
||||||
# Wait for all scans to complete
|
# Wait for all scans to complete
|
||||||
for pid in "${scan_pids[@]}"; do
|
for pid in "${scan_pids[@]}"; do
|
||||||
wait "$pid" 2>/dev/null || true
|
wait "$pid" 2> /dev/null || true
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -t 1 ]]; then
|
if [[ -t 1 ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user