mirror of
https://github.com/tw93/Mole.git
synced 2026-03-22 18:30:08 +00:00
✨ Support Disk Space Analyzer
This commit is contained in:
29
mole
29
mole
@@ -4,11 +4,13 @@
|
||||
#
|
||||
# 🧹 Clean - Remove junk files and optimize system
|
||||
# 🗑️ Uninstall - Remove applications completely
|
||||
# 📊 Analyze - Interactive disk space explorer
|
||||
#
|
||||
# Usage:
|
||||
# ./mole # Interactive main menu
|
||||
# ./mole clean # Direct clean mode
|
||||
# ./mole uninstall # Direct uninstall mode
|
||||
# ./mole analyze # Disk space explorer
|
||||
# ./mole --help # Show help
|
||||
|
||||
set -euo pipefail
|
||||
@@ -129,6 +131,7 @@ show_help() {
|
||||
printf " %s%-28s%s %s\n" "$GREEN" "mole clean" "$NC" "Deeper system cleanup"
|
||||
printf " %s%-28s%s %s\n" "$GREEN" "mole clean --dry-run" "$NC" "Preview cleanup (no deletions)"
|
||||
printf " %s%-28s%s %s\n" "$GREEN" "mole uninstall" "$NC" "Remove applications completely"
|
||||
printf " %s%-28s%s %s\n" "$GREEN" "mole analyze" "$NC" "Interactive disk space explorer"
|
||||
printf " %s%-28s%s %s\n" "$GREEN" "mole update" "$NC" "Update Mole to the latest version"
|
||||
printf " %s%-28s%s %s\n" "$GREEN" "mole --version" "$NC" "Show installed version"
|
||||
printf " %s%-28s%s %s\n" "$GREEN" "mole --help" "$NC" "Show this help message"
|
||||
@@ -213,14 +216,15 @@ show_main_menu() {
|
||||
printf '\033[u\033[0J'
|
||||
fi
|
||||
|
||||
show_menu_option 1 "Clean System - Remove junk files and optimize" "$([[ $selected -eq 1 ]] && echo true || echo false)"
|
||||
show_menu_option 1 "Clean Mac - Remove junk files and optimize" "$([[ $selected -eq 1 ]] && echo true || echo false)"
|
||||
show_menu_option 2 "Uninstall Apps - Remove applications completely" "$([[ $selected -eq 2 ]] && echo true || echo false)"
|
||||
show_menu_option 3 "Help & Information - Usage guide and tips" "$([[ $selected -eq 3 ]] && echo true || echo false)"
|
||||
show_menu_option 4 "Exit - Close Mole" "$([[ $selected -eq 4 ]] && echo true || echo false)"
|
||||
show_menu_option 3 "Analyze Disk - Interactive space explorer" "$([[ $selected -eq 3 ]] && echo true || echo false)"
|
||||
show_menu_option 4 "Help & Information - Usage guide and tips" "$([[ $selected -eq 4 ]] && echo true || echo false)"
|
||||
show_menu_option 5 "Exit - Close Mole" "$([[ $selected -eq 5 ]] && echo true || echo false)"
|
||||
|
||||
if [[ -t 0 ]]; then
|
||||
echo ""
|
||||
echo -e "${BLUE}↑/↓ to navigate, ENTER to select, Q to quit${NC}"
|
||||
echo -e " ${GRAY}↑/↓${NC} Navigate ${GRAY}|${NC} ${GRAY}Enter${NC} Select ${GRAY}|${NC} ${GRAY}Q/ESC${NC} Quit"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -260,7 +264,7 @@ interactive_main_menu() {
|
||||
|
||||
case "$key" in
|
||||
"UP") ((current_option > 1)) && ((current_option--)) ;;
|
||||
"DOWN") ((current_option < 4)) && ((current_option++)) ;;
|
||||
"DOWN") ((current_option < 5)) && ((current_option++)) ;;
|
||||
"ENTER"|"$current_option")
|
||||
show_cursor
|
||||
case $current_option in
|
||||
@@ -268,20 +272,22 @@ interactive_main_menu() {
|
||||
exec "$SCRIPT_DIR/bin/clean.sh"
|
||||
;;
|
||||
2) exec "$SCRIPT_DIR/bin/uninstall.sh" ;;
|
||||
3) clear; show_help; exit 0 ;;
|
||||
4) cleanup_and_exit ;;
|
||||
3) exec "$SCRIPT_DIR/bin/analyze.sh" ;;
|
||||
4) clear; show_help; exit 0 ;;
|
||||
5) cleanup_and_exit ;;
|
||||
esac
|
||||
;;
|
||||
"QUIT") cleanup_and_exit ;;
|
||||
[1-4])
|
||||
[1-5])
|
||||
show_cursor
|
||||
case $key in
|
||||
1)
|
||||
exec "$SCRIPT_DIR/bin/clean.sh"
|
||||
;;
|
||||
2) exec "$SCRIPT_DIR/bin/uninstall.sh" ;;
|
||||
3) clear; show_help; exit 0 ;;
|
||||
4) cleanup_and_exit ;;
|
||||
3) exec "$SCRIPT_DIR/bin/analyze.sh" ;;
|
||||
4) clear; show_help; exit 0 ;;
|
||||
5) cleanup_and_exit ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
@@ -296,6 +302,9 @@ main() {
|
||||
"uninstall")
|
||||
exec "$SCRIPT_DIR/bin/uninstall.sh"
|
||||
;;
|
||||
"analyze")
|
||||
exec "$SCRIPT_DIR/bin/analyze.sh" "${@:2}"
|
||||
;;
|
||||
"update")
|
||||
update_mole
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user