From 1c4b033cf74621298fc39b1e3d6bd9236620fdc5 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Tue, 30 Dec 2025 14:55:43 +0800 Subject: [PATCH] refactor: rename total_size_bytes to total_size_kb in clean.sh for clarity --- bin/clean.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bin/clean.sh b/bin/clean.sh index 7f790cd..4dd41df 100755 --- a/bin/clean.sh +++ b/bin/clean.sh @@ -198,7 +198,7 @@ safe_clean() { fi local removed_any=0 - local total_size_bytes=0 + local total_size_kb=0 local total_count=0 local skipped_count=0 local removal_failed_count=0 @@ -329,7 +329,7 @@ safe_clean() { fi fi if [[ $removed -eq 1 ]]; then - ((total_size_bytes += size)) + ((total_size_kb += size)) ((total_count += 1)) removed_any=1 else @@ -344,13 +344,13 @@ safe_clean() { else local idx=0 for path in "${existing_paths[@]}"; do - local size_bytes - size_bytes=$(get_path_size_kb "$path") - # Ensure size_bytes is numeric (additional safety layer) - [[ ! "$size_bytes" =~ ^[0-9]+$ ]] && size_bytes=0 + local size_kb + size_kb=$(get_path_size_kb "$path") + # Ensure size_kb is numeric (additional safety layer) + [[ ! "$size_kb" =~ ^[0-9]+$ ]] && size_kb=0 # Optimization: Skip expensive file counting - if [[ "$size_bytes" -gt 0 ]]; then + if [[ "$size_kb" -gt 0 ]]; then local removed=1 if [[ "$DRY_RUN" != "true" ]]; then removed=0 @@ -364,7 +364,7 @@ safe_clean() { fi fi if [[ $removed -eq 1 ]]; then - ((total_size_bytes += size_bytes)) + ((total_size_kb += size_kb)) ((total_count += 1)) removed_any=1 else @@ -390,7 +390,7 @@ safe_clean() { fi if [[ $removed_any -eq 1 ]]; then - local size_human=$(bytes_to_human "$((total_size_bytes * 1024))") + local size_human=$(bytes_to_human "$((total_size_kb * 1024))") local label="$description" if [[ ${#targets[@]} -gt 1 ]]; then @@ -461,7 +461,7 @@ safe_clean() { echo -e " ${GREEN}${ICON_SUCCESS}${NC} $label ${GREEN}($size_human)${NC}" fi ((files_cleaned += total_count)) - ((total_size_cleaned += total_size_bytes)) + ((total_size_cleaned += total_size_kb)) ((total_items++)) note_activity fi