From f842d4092fb3e7dfed2ee332c927905d1a106eb1 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Tue, 14 Oct 2025 19:43:59 +0800 Subject: [PATCH] Delete useless help and optimize format --- .github/workflows/tests.yml | 3 +++ bin/analyze.sh | 44 ------------------------------------- bin/clean.sh | 15 +------------ bin/touchid.sh | 32 --------------------------- bin/uninstall.sh | 34 ---------------------------- lib/paginated_menu.sh | 1 - 6 files changed, 4 insertions(+), 125 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2a155bd..8444494 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,5 +16,8 @@ jobs: - name: Install tools run: brew install bats-core shfmt shellcheck + - name: Format code + run: ./scripts/format.sh + - name: Run all checks run: ./scripts/check.sh diff --git a/bin/analyze.sh b/bin/analyze.sh index 75befc5..cd2cdf2 100755 --- a/bin/analyze.sh +++ b/bin/analyze.sh @@ -2392,50 +2392,6 @@ export_to_json() { main() { local target_path="$HOME" - # Parse arguments - only support --help - while [[ $# -gt 0 ]]; do - case "$1" in - -h | --help) - echo "Usage: mole analyze" - echo "" - echo "Interactive disk space explorer - Navigate folders sorted by size" - echo "" - echo "Keyboard Controls:" - echo " ${ICON_NAV_UP}/${ICON_NAV_DOWN} Navigate items" - echo " Enter / ${ICON_NAV_RIGHT} Open selected folder" - echo " ${ICON_NAV_LEFT} Go back to parent directory" - echo " Delete Delete selected file/folder (requires confirmation)" - echo " O Reveal current directory in Finder" - echo " Q / ESC Quit the explorer" - echo "" - echo "Features:" - echo " ${ICON_LIST} Files and folders sorted by size (largest first)" - echo " ${ICON_LIST} Shows top 16 items per directory" - echo " ${ICON_LIST} Fast parallel scanning with smart timeout" - echo " ${ICON_LIST} Session cache for instant navigation" - echo " ${ICON_LIST} Color coding for large folders (Red >10GB, Yellow >1GB)" - echo " ${ICON_LIST} Safe deletion with confirmation" - echo "" - echo "Examples:" - echo " mole analyze Start exploring from home directory" - echo "" - exit 0 - ;; - -*) - echo "Error: Unknown option: $1" >&2 - echo "Usage: mole analyze" >&2 - echo "Use 'mole analyze --help' for more information" >&2 - exit 1 - ;; - *) - echo "Error: Paths are not supported in beta version" >&2 - echo "Usage: mole analyze" >&2 - echo "The explorer will start from your home directory" >&2 - exit 1 - ;; - esac - done - CURRENT_PATH="$target_path" # Create cache directory diff --git a/bin/clean.sh b/bin/clean.sh index cb27aa1..0749d4a 100755 --- a/bin/clean.sh +++ b/bin/clean.sh @@ -1412,7 +1412,7 @@ perform_cleanup() { } main() { - # Parse args (only dry-run and help for minimal impact) + # Parse args (only dry-run and whitelist) for arg in "$@"; do case "$arg" in "--dry-run" | "-n") @@ -1423,19 +1423,6 @@ main() { manage_whitelist exit 0 ;; - "--help" | "-h") - echo "Mole - Deeper system cleanup" - echo "Usage: clean.sh [options]" - echo "" - echo "Options:" - echo " --help, -h Show this help" - echo " --dry-run, -n Preview what would be cleaned without deleting" - echo " --whitelist Manage protected caches" - echo "" - echo "Interactive cleanup with smart password handling" - echo "" - exit 0 - ;; esac done diff --git a/bin/touchid.sh b/bin/touchid.sh index a882460..7a7ab5b 100755 --- a/bin/touchid.sh +++ b/bin/touchid.sh @@ -137,33 +137,6 @@ disable_touchid() { fi } -# Show help -show_help() { - cat << EOF -Usage: mo touchid [command] - -Configure Touch ID for sudo to avoid repeated password prompts. - -Commands: - enable Enable Touch ID for sudo - disable Disable Touch ID for sudo - status Show current Touch ID configuration - help Show this help message - -Examples: - mo touchid # Show status and options - mo touchid enable # Enable Touch ID - mo touchid status # Check current status - -Notes: - - Requires macOS with Touch ID sensor - - Changes are applied to /etc/pam.d/sudo - - Automatic backup is created before changes - - You can restore from backup at ${PAM_SUDO_FILE}.mole-backup - -EOF -} - # Interactive menu show_menu() { echo "" @@ -220,16 +193,11 @@ main() { status) show_status ;; - help | --help | -h) - show_help - ;; "") show_menu ;; *) log_error "Unknown command: $command" - echo "" - show_help exit 1 ;; esac diff --git a/bin/uninstall.sh b/bin/uninstall.sh index 135c8a4..f77fca5 100755 --- a/bin/uninstall.sh +++ b/bin/uninstall.sh @@ -21,40 +21,6 @@ source "$SCRIPT_DIR/../lib/batch_uninstall.sh" # Note: Bundle preservation logic is now in lib/common.sh -# Help information -show_help() { - echo "Usage: mole uninstall" - echo "" - echo "Interactive application uninstaller - Remove apps completely" - echo "" - echo "Keyboard Controls:" - echo " ${ICON_NAV_UP}/${ICON_NAV_DOWN} Navigate items" - echo " Space Select/deselect" - echo " Enter Confirm and uninstall" - echo " Q / ESC Quit" - echo "" - echo "What gets cleaned:" - echo " ${ICON_LIST} Application bundle" - echo " ${ICON_LIST} Application Support data (12+ locations)" - echo " ${ICON_LIST} Cache files" - echo " ${ICON_LIST} Preference files" - echo " ${ICON_LIST} Log files" - echo " ${ICON_LIST} Saved application state" - echo " ${ICON_LIST} Container data (sandboxed apps)" - echo " ${ICON_LIST} WebKit storage, HTTP storage, cookies" - echo " ${ICON_LIST} Extensions, plugins, services" - echo "" - echo "Examples:" - echo " mole uninstall Launch interactive uninstaller" - echo "" -} - -# Parse arguments -if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then - show_help - exit 0 -fi - # Initialize global variables selected_apps=() # Global array for app selection declare -a apps_data=() diff --git a/lib/paginated_menu.sh b/lib/paginated_menu.sh index 011d133..31eb40e 100755 --- a/lib/paginated_menu.sh +++ b/lib/paginated_menu.sh @@ -356,7 +356,6 @@ paginated_multi_select() { # Header only printf "${clear_line}${PURPLE}%s${NC} ${GRAY}%d/%d selected${NC}\n" "${title}" "$selected_count" "$total_items" >&2 - printf "${clear_line}\n" >&2 # Visible slice local visible_total=${#view_indices[@]}