1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-22 17:55:08 +00:00

refactor: Update shell arithmetic increment syntax from ((var++)) || true to var=$((var + 1)) across various scripts.

This commit is contained in:
tw93
2026-02-28 11:10:18 +08:00
parent 7d70889ad4
commit c19a0276b8
22 changed files with 141 additions and 141 deletions

View File

@@ -317,7 +317,7 @@ batch_uninstall_applications() {
local system_size_kb=$(calculate_total_size "$system_files" || echo "0")
local diag_system_size_kb=$(calculate_total_size "$diag_system" || echo "0")
local total_kb=$((app_size_kb + related_size_kb + system_size_kb + diag_system_size_kb))
((total_estimated_size += total_kb)) || true
total_estimated_size=$((total_estimated_size + total_kb))
# shellcheck disable=SC2128
if [[ -n "$system_files" || -n "$diag_system" ]]; then
@@ -465,7 +465,7 @@ batch_uninstall_applications() {
local -a success_items=()
local current_index=0
for detail in "${app_details[@]}"; do
((current_index++)) || true
current_index=$((current_index + 1))
IFS='|' read -r app_name app_path bundle_id total_kb encoded_files encoded_system_files has_sensitive_data needs_sudo is_brew_cask cask_name encoded_diag_system <<< "$detail"
local related_files=$(decode_file_list "$encoded_files" "$app_name")
local system_files=$(decode_file_list "$encoded_system_files" "$app_name")
@@ -610,11 +610,11 @@ batch_uninstall_applications() {
fi
fi
((total_size_freed += total_kb)) || true
((success_count++)) || true
[[ "$used_brew_successfully" == "true" ]] && ((brew_apps_removed++)) || true
((files_cleaned++)) || true
((total_items++)) || true
total_size_freed=$((total_size_freed + total_kb))
success_count=$((success_count + 1))
[[ "$used_brew_successfully" == "true" ]] && brew_apps_removed=$((brew_apps_removed + 1))
files_cleaned=$((files_cleaned + 1))
total_items=$((total_items + 1))
success_items+=("$app_path")
else
if [[ -t 1 ]]; then
@@ -628,7 +628,7 @@ batch_uninstall_applications() {
fi
fi
((failed_count++)) || true
failed_count=$((failed_count + 1))
failed_items+=("$app_name:$reason:${suggestion:-}")
fi
done
@@ -672,7 +672,7 @@ batch_uninstall_applications() {
else
current_line="$current_line, $display_item"
fi
((idx++)) || true
idx=$((idx + 1))
done
if [[ -n "$current_line" ]]; then
summary_details+=("$current_line")
@@ -765,6 +765,6 @@ batch_uninstall_applications() {
_restore_uninstall_traps
unset -f _restore_uninstall_traps
((total_size_cleaned += total_size_freed)) || true
total_size_cleaned=$((total_size_cleaned + total_size_freed))
unset failed_items
}