1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-07 22:39:17 +00:00
This commit is contained in:
Tw93
2025-11-25 17:25:13 +08:00
parent 2830eb69ca
commit e517bf4a3e
16 changed files with 331 additions and 326 deletions

View File

@@ -4,11 +4,14 @@
set -euo pipefail
readonly MAIL_DOWNLOADS_MIN_KB=5120 # ~5MB threshold
readonly MAIL_DOWNLOADS_MIN_KB=5120 # ~5MB threshold
_opt_get_dir_size_kb() {
local path="$1"
[[ -e "$path" ]] || { echo 0; return; }
[[ -e "$path" ]] || {
echo 0
return
}
du -sk "$path" 2> /dev/null | awk '{print $1}' || echo 0
}
@@ -352,19 +355,19 @@ execute_optimization() {
local path="${2:-}"
case "$action" in
system_maintenance) opt_system_maintenance ;;
cache_refresh) opt_cache_refresh ;;
maintenance_scripts) opt_maintenance_scripts ;;
log_cleanup) opt_log_cleanup ;;
recent_items) opt_recent_items ;;
radio_refresh) opt_radio_refresh ;;
mail_downloads) opt_mail_downloads ;;
saved_state_cleanup) opt_saved_state_cleanup ;;
finder_dock_refresh) opt_finder_dock_refresh ;;
swap_cleanup) opt_swap_cleanup ;;
startup_cache) opt_startup_cache ;;
local_snapshots) opt_local_snapshots ;;
developer_cleanup) opt_developer_cleanup ;;
system_maintenance) opt_system_maintenance ;;
cache_refresh) opt_cache_refresh ;;
maintenance_scripts) opt_maintenance_scripts ;;
log_cleanup) opt_log_cleanup ;;
recent_items) opt_recent_items ;;
radio_refresh) opt_radio_refresh ;;
mail_downloads) opt_mail_downloads ;;
saved_state_cleanup) opt_saved_state_cleanup ;;
finder_dock_refresh) opt_finder_dock_refresh ;;
swap_cleanup) opt_swap_cleanup ;;
startup_cache) opt_startup_cache ;;
local_snapshots) opt_local_snapshots ;;
developer_cleanup) opt_developer_cleanup ;;
*)
echo -e "${RED}${ICON_ERROR}${NC} Unknown action: $action"
return 1