1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-10 13:09:16 +00:00

Neat and simple content

This commit is contained in:
Tw93
2025-11-22 14:14:23 +08:00
parent 853d60e4e2
commit 804c4c2161
2 changed files with 32 additions and 32 deletions

View File

@@ -27,7 +27,7 @@ show_system_health() {
local uptime=$(echo "$health_json" | jq -r '.uptime_days') local uptime=$(echo "$health_json" | jq -r '.uptime_days')
# Compact one-line format with icon # Compact one-line format with icon
printf "${ICON_ADMIN} System: %.0f/%.0f GB RAM | %.0f/%.0f GB Disk (%.0f%%) | Uptime %.0fd\n" \ printf "${ICON_ADMIN} System %.0f/%.0f GB RAM | %.0f/%.0f GB Disk (%.0f%%) | Uptime %.0fd\n" \
"$mem_used" "$mem_total" "$disk_used" "$disk_total" "$disk_percent" "$uptime" "$mem_used" "$mem_total" "$disk_used" "$disk_total" "$disk_percent" "$uptime"
echo "" echo ""
} }
@@ -451,17 +451,19 @@ main() {
# Check dependencies # Check dependencies
if ! command -v jq > /dev/null 2>&1; then if ! command -v jq > /dev/null 2>&1; then
log_error "jq is required but not installed. Install with: brew install jq" echo -e "${RED}${ICON_ERROR}${NC} Missing dependency: jq"
echo -e "${GRAY}Install with: ${GREEN}brew install jq${NC}"
exit 1 exit 1
fi fi
if ! command -v bc > /dev/null 2>&1; then if ! command -v bc > /dev/null 2>&1; then
log_error "bc is required but not installed. Install with: brew install bc" echo -e "${RED}${ICON_ERROR}${NC} Missing dependency: bc"
echo -e "${GRAY}Install with: ${GREEN}brew install bc${NC}"
exit 1 exit 1
fi fi
# Simple confirmation first # Simple confirmation first
echo -ne "${PURPLE}${ICON_ARROW}${NC} Admin access required ${GREEN}Enter${NC} confirm, ${GRAY}ESC${NC} cancel: " echo -ne "${PURPLE}${ICON_ARROW}${NC} System optimization needs admin access ${GREEN}Enter${NC} continue / ${GRAY}ESC${NC} cancel: "
IFS= read -r -s -n1 key || key="" IFS= read -r -s -n1 key || key=""
drain_pending_input # Clean up any escape sequence remnants drain_pending_input # Clean up any escape sequence remnants
@@ -554,7 +556,7 @@ main() {
if ((${#login_items_list[@]} > 0)); then if ((${#login_items_list[@]} > 0)); then
local display_count=${#login_items_list[@]} local display_count=${#login_items_list[@]}
echo "" echo ""
echo -e "${BLUE}${ICON_ARROW}${NC} Login items (${display_count}) auto-start at login:" echo -e "${BLUE}${ICON_ARROW}${NC} Found ${display_count} items that auto-start at login:"
local preview_limit=5 local preview_limit=5
((preview_limit > display_count)) && preview_limit=$display_count ((preview_limit > display_count)) && preview_limit=$display_count
for ((i = 0; i < preview_limit; i++)); do for ((i = 0; i < preview_limit; i++)); do
@@ -564,27 +566,27 @@ main() {
local remaining=$((display_count - preview_limit)) local remaining=$((display_count - preview_limit))
echo " • …and $remaining more" echo " • …and $remaining more"
fi fi
echo -e "${GRAY}Review System Settings → General → Login Items to trim extras.${NC}" echo -e "${GRAY}Review in System Settings → Login Items to remove unnecessary ones${NC}"
fi fi
echo "" echo ""
local summary_title="System optimization completed" local summary_title="System optimization complete"
local -a summary_details=() local -a summary_details=()
local safe_count=${#safe_items[@]} local safe_count=${#safe_items[@]}
local confirm_count=${#confirm_items[@]} local confirm_count=${#confirm_items[@]}
if ((safe_count > 0)); then if ((safe_count > 0)); then
summary_details+=("Automations: ${GREEN}${safe_count}${NC} sections optimized end-to-end.") summary_details+=("Applied ${GREEN}${safe_count}${NC} optimizations")
else else
summary_details+=("Automations: No automated changes were necessary.") summary_details+=("System already optimized")
fi fi
if ((confirm_count > 0)); then if ((confirm_count > 0)); then
summary_details+=("Follow-ups: ${YELLOW}${confirm_count}${NC} manual checks suggested (see log).") summary_details+=("${YELLOW}${confirm_count}${NC} manual checks suggested")
fi fi
summary_details+=("Highlights: caches refreshed, services restarted, startup assets rebuilt.") summary_details+=("Caches cleared, databases rebuilt, services refreshed")
summary_details+=("Result: system responsiveness should feel lighter.") summary_details+=("System should feel faster and more responsive")
local show_touchid_tip="false" local show_touchid_tip="false"
if touchid_supported && ! touchid_configured; then if touchid_supported && ! touchid_configured; then

38
mole
View File

@@ -22,7 +22,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/lib/common.sh" source "$SCRIPT_DIR/lib/common.sh"
# Version info # Version info
VERSION="1.10.3" VERSION="1.10.4"
MOLE_TAGLINE="can dig deep to clean your Mac." MOLE_TAGLINE="can dig deep to clean your Mac."
# Check if Touch ID is already configured # Check if Touch ID is already configured
@@ -168,22 +168,20 @@ show_help() {
show_brand_banner show_brand_banner
echo echo
printf "%s%s%s\n" "$BLUE" "COMMANDS" "$NC" printf "%s%s%s\n" "$BLUE" "COMMANDS" "$NC"
printf " %s%-28s%s %s\n" "$GREEN" "mo" "$NC" "Interactive main menu" printf " %s%-28s%s %s\n" "$GREEN" "mo" "$NC" "Main menu"
printf " %s%-28s%s %s\n" "$GREEN" "mo clean" "$NC" "Deeper system cleanup" printf " %s%-28s%s %s\n" "$GREEN" "mo clean" "$NC" "Free up disk space"
printf " %s%-28s%s %s\n" "$GREEN" "mo clean --dry-run" "$NC" "Preview cleanup (no deletions)" printf " %s%-28s%s %s\n" "$GREEN" "mo clean --dry-run" "$NC" "Preview cleanup"
printf " %s%-28s%s %s\n" "$GREEN" "mo clean --whitelist" "$NC" "Manage protected caches" printf " %s%-28s%s %s\n" "$GREEN" "mo clean --whitelist" "$NC" "Manage protected caches"
printf " %s%-28s%s %s\n" "$GREEN" "mo uninstall" "$NC" "Remove applications completely" printf " %s%-28s%s %s\n" "$GREEN" "mo uninstall" "$NC" "Remove apps completely"
printf " %s%-28s%s %s\n" "$GREEN" "mo optimize" "$NC" "System health check & optimization" printf " %s%-28s%s %s\n" "$GREEN" "mo optimize" "$NC" "Tune system performance"
printf " %s%-28s%s %s\n" "$GREEN" "mo analyze" "$NC" "Interactive disk space explorer" printf " %s%-28s%s %s\n" "$GREEN" "mo analyze" "$NC" "Explore disk usage"
printf " %s%-28s%s %s\n" "$GREEN" "mo status" "$NC" "System status dashboard" printf " %s%-28s%s %s\n" "$GREEN" "mo status" "$NC" "Monitor system health"
printf " %s%-28s%s %s\n" "$GREEN" "mo touchid" "$NC" "Configure Touch ID for sudo" printf " %s%-28s%s %s\n" "$GREEN" "mo touchid" "$NC" "Configure Touch ID for sudo"
printf " %s%-28s%s %s\n" "$GREEN" "mo update" "$NC" "Update Mole to the latest version" printf " %s%-28s%s %s\n" "$GREEN" "mo update" "$NC" "Update to latest version"
printf " %s%-28s%s %s\n" "$GREEN" "mo remove" "$NC" "Remove Mole from the system" printf " %s%-28s%s %s\n" "$GREEN" "mo remove" "$NC" "Remove Mole from system"
printf " %s%-28s%s %s\n" "$GREEN" "mo --version" "$NC" "Show installed version" printf " %s%-28s%s %s\n" "$GREEN" "mo --version" "$NC" "Show version"
printf " %s%-28s%s %s\n" "$GREEN" "mo --help" "$NC" "Show this help message" printf " %s%-28s%s %s\n" "$GREEN" "mo --help" "$NC" "Show help"
echo
printf "\n%s%s%s\n" "$BLUE" "MORE" "$NC"
printf " https://github.com/tw93/mole\n\n"
} }
# Simple update function # Simple update function
@@ -506,11 +504,11 @@ show_main_menu() {
# Spacer before menu options # Spacer before menu options
printf '\r\033[2K\n' printf '\r\033[2K\n'
printf '\r\033[2K%s\n' "$(show_menu_option 1 "Clean Mac - Remove junk files and optimize" "$([[ $selected -eq 1 ]] && echo true || echo false)")" printf '\r\033[2K%s\n' "$(show_menu_option 1 "Clean Free up disk space" "$([[ $selected -eq 1 ]] && echo true || echo false)")"
printf '\r\033[2K%s\n' "$(show_menu_option 2 "Uninstall Apps - Remove applications completely" "$([[ $selected -eq 2 ]] && echo true || echo false)")" printf '\r\033[2K%s\n' "$(show_menu_option 2 "Uninstall Remove apps completely" "$([[ $selected -eq 2 ]] && echo true || echo false)")"
printf '\r\033[2K%s\n' "$(show_menu_option 3 "Optimize Mac - System health & tuning" "$([[ $selected -eq 3 ]] && echo true || echo false)")" printf '\r\033[2K%s\n' "$(show_menu_option 3 "Optimize Tune system performance" "$([[ $selected -eq 3 ]] && echo true || echo false)")"
printf '\r\033[2K%s\n' "$(show_menu_option 4 "Analyze Disk - Interactive space explorer" "$([[ $selected -eq 4 ]] && echo true || echo false)")" printf '\r\033[2K%s\n' "$(show_menu_option 4 "Analyze Explore disk usage" "$([[ $selected -eq 4 ]] && echo true || echo false)")"
printf '\r\033[2K%s\n' "$(show_menu_option 5 "System Status - Live CPU/GPU/memory" "$([[ $selected -eq 5 ]] && echo true || echo false)")" printf '\r\033[2K%s\n' "$(show_menu_option 5 "Status Monitor system health" "$([[ $selected -eq 5 ]] && echo true || echo false)")"
if [[ -t 0 ]]; then if [[ -t 0 ]]; then
printf '\r\033[2K\n' printf '\r\033[2K\n'