From edae8513d1b6bd6ea47f19c7fa92c4985032ee63 Mon Sep 17 00:00:00 2001 From: Peter Wood Date: Sat, 7 Mar 2026 11:01:20 -0500 Subject: [PATCH] feat: Improve help command formatting for better readability --- plex/plex-db-manager.sh | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/plex/plex-db-manager.sh b/plex/plex-db-manager.sh index d357d16..e4dfdf8 100755 --- a/plex/plex-db-manager.sh +++ b/plex/plex-db-manager.sh @@ -534,26 +534,28 @@ check_all_databases() { # Show help show_help() { - echo -e "${BOLD}${WHITE}Usage:${RESET} ${CYAN}$(basename "$0")${RESET} ${YELLOW}${RESET} ${DIM}[options]${RESET}" + local script + script=$(basename "$0") + echo -e "${BOLD}${WHITE}Usage:${RESET} ${CYAN}${script}${RESET} ${YELLOW}${RESET} ${DIM}[options]${RESET}" echo "" echo -e "${BOLD}${WHITE}Commands:${RESET}" - echo -e " ${GREEN}${BOLD}check${RESET} Read-only database integrity check" - echo -e " ${YELLOW}${BOLD}repair${RESET} Interactive database repair" - echo -e " ${YELLOW}${BOLD}repair --gentle${RESET} Gentle repair methods only" - echo -e " ${RED}${BOLD}repair --force${RESET} Aggressive repair methods" - echo -e " ${RED}${BOLD}nuclear${RESET} Nuclear recovery (replace from backup)" - echo -e " ${CYAN}${BOLD}backups${RESET} List and manage database backup files" - echo -e " ${GREEN}${BOLD}install-dbrepair${RESET} Install or update DBRepair tool" - echo -e " ${CYAN}${BOLD}help${RESET} Show this help message" + printf " ${GREEN}${BOLD}%-18s${RESET} %s\n" "check" "Read-only database integrity check" + printf " ${YELLOW}${BOLD}%-18s${RESET} %s\n" "repair" "Interactive database repair" + printf " ${YELLOW}${BOLD}%-18s${RESET} %s\n" "repair --gentle" "Gentle repair methods only" + printf " ${RED}${BOLD}%-18s${RESET} %s\n" "repair --force" "Aggressive repair methods" + printf " ${RED}${BOLD}%-18s${RESET} %s\n" "nuclear" "Nuclear recovery (replace from backup)" + printf " ${CYAN}${BOLD}%-18s${RESET} %s\n" "backups" "List and manage database backup files" + printf " ${GREEN}${BOLD}%-18s${RESET} %s\n" "install-dbrepair" "Install or update DBRepair tool" + printf " ${CYAN}${BOLD}%-18s${RESET} %s\n" "help" "Show this help message" echo "" echo -e "${BOLD}${WHITE}Examples:${RESET}" - echo -e " ${DIM}$(basename "$0") check # Safe integrity check${RESET}" - echo -e " ${DIM}$(basename "$0") repair # Interactive repair${RESET}" - echo -e " ${DIM}$(basename "$0") repair --gentle # Minimal repair only${RESET}" - echo -e " ${DIM}$(basename "$0") backups # List DB backups${RESET}" - echo -e " ${DIM}$(basename "$0") backups delete # Interactive backup deletion${RESET}" - echo -e " ${DIM}$(basename "$0") backups delete --name foo # Delete by name pattern${RESET}" - echo -e " ${DIM}$(basename "$0") install-dbrepair # Install/update DBRepair${RESET}" + printf " ${DIM}%-46s # %s${RESET}\n" "${script} check" "Safe integrity check" + printf " ${DIM}%-46s # %s${RESET}\n" "${script} repair" "Interactive repair" + printf " ${DIM}%-46s # %s${RESET}\n" "${script} repair --gentle" "Minimal repair only" + printf " ${DIM}%-46s # %s${RESET}\n" "${script} backups" "List DB backups" + printf " ${DIM}%-46s # %s${RESET}\n" "${script} backups delete" "Interactive backup deletion" + printf " ${DIM}%-46s # %s${RESET}\n" "${script} backups delete --name foo" "Delete by name pattern" + printf " ${DIM}%-46s # %s${RESET}\n" "${script} install-dbrepair" "Install/update DBRepair" echo "" echo -e "${BOLD}${YELLOW}⚠️ WARNING:${RESET} Always run ${CYAN}check${RESET} first before attempting repairs!" echo ""