feat: Update color code definitions for consistency across scripts

This commit is contained in:
Peter Wood
2026-03-12 11:18:36 -04:00
parent 70ec810f58
commit 33d64041ff
12 changed files with 109 additions and 80 deletions

View File

@@ -57,16 +57,16 @@
set -euo pipefail
# 🎨 Color definitions for sexy output
readonly RED='\033[0;31m'
readonly GREEN='\033[0;32m'
readonly YELLOW='\033[1;33m'
readonly BLUE='\033[0;34m'
readonly PURPLE='\033[0;35m'
readonly CYAN='\033[0;36m'
readonly WHITE='\033[1;37m'
readonly BOLD='\033[1m'
readonly DIM='\033[2m'
readonly RESET='\033[0m'
readonly RED=$'\033[0;31m'
readonly GREEN=$'\033[0;32m'
readonly YELLOW=$'\033[1;33m'
readonly BLUE=$'\033[0;34m'
readonly PURPLE=$'\033[0;35m'
readonly CYAN=$'\033[0;36m'
readonly WHITE=$'\033[1;37m'
readonly BOLD=$'\033[1m'
readonly DIM=$'\033[2m'
readonly RESET=$'\033[0m'
# 🔧 Configuration
readonly PLEX_SERVICE="plexmediaserver"
@@ -784,6 +784,7 @@ show_help() {
printf " ${RED}${BOLD}%-18s${RESET} %s %s\n" "nuclear" "[!!]" "Nuclear database recovery (last resort)"
printf " ${CYAN}${BOLD}%-18s${RESET} %s %s\n" "backups" "[#]" "List and manage database backup files"
printf " ${GREEN}${BOLD}%-18s${RESET} %s %s\n" "install-dbrepair" "[+]" "Install or update DBRepair tool"
printf " ${WHITE}${BOLD}%-18s${RESET} %s %s\n" "tui" "[>]" "Launch interactive TUI dashboard"
printf " ${PURPLE}${BOLD}%-18s${RESET} %s %s\n" "help" "${HOURGLASS}" "Show this help message"
echo ""
echo -e "${DIM}${WHITE}Examples:${RESET}"
@@ -796,10 +797,35 @@ show_help() {
printf " ${DIM}%-40s # %s${RESET}\n" "${SCRIPT_NAME} backups delete" "Interactive backup deletion"
printf " ${DIM}%-40s # %s${RESET}\n" "${SCRIPT_NAME} backups delete --name foo" "Delete by name pattern"
printf " ${DIM}%-40s # %s${RESET}\n" "${SCRIPT_NAME} install-dbrepair" "Install/update DBRepair"
printf " ${DIM}%-40s # %s${RESET}\n" "${SCRIPT_NAME} tui" "Launch full TUI dashboard"
echo ""
}
# 📚 Function to launch library scanner
# <EFBFBD> Function to launch the Python TUI dashboard
launch_tui() {
local venv_dir="${SCRIPT_DIR}/.venv"
local tui_app="${SCRIPT_DIR}/tui/app.py"
if [[ ! -f "$tui_app" ]]; then
print_status "${CROSS}" "TUI application not found: $tui_app" "${RED}"
return 1
fi
# Create venv and install dependencies if needed
if [[ ! -d "$venv_dir" ]]; then
print_status "${INFO}" "Setting up Python environment (first run)..." "${BLUE}"
if ! python3 -m venv "$venv_dir" 2>/dev/null; then
print_status "${CROSS}" "Failed to create Python venv. Install python3-venv." "${RED}"
return 1
fi
"${venv_dir}/bin/pip" install --quiet textual
print_status "${CHECKMARK}" "Python environment ready" "${GREEN}"
fi
exec "${venv_dir}/bin/python3" "$tui_app"
}
# <20>📚 Function to launch library scanner
launch_scanner() {
print_status "${SPARKLES}" "Launching Plex Library Scanner..." "${PURPLE}"
@@ -966,6 +992,9 @@ main() {
"install-dbrepair"|"update-dbrepair"|"dbrepair")
install_or_update_dbrepair
;;
"tui"|"dashboard"|"ui")
launch_tui
;;
"backups"|"backup-list")
if [[ $# -ge 2 && "${2,,}" == "delete" ]]; then
if [[ $# -ge 4 && "${3}" == "--name" ]]; then