diff --git a/commando/ui/dashboard.py b/commando/ui/dashboard.py index 894a07b..b5b2bc8 100644 --- a/commando/ui/dashboard.py +++ b/commando/ui/dashboard.py @@ -19,7 +19,6 @@ clear_screen, pause, save_json, - get_category_color, format_badge, ) @@ -28,7 +27,9 @@ def print_dashboard(session_history, pending_imports): clear_screen() print(f"{CYAN}{BOLD}╔════════════════════════════════════════════════════╗{RESET}") print(f"{CYAN}{BOLD}║ Terminal Command Explorer & Tutor ║{RESET}") - print(f"{CYAN}{BOLD}╚════════════════════════════════════════════════════╝{RESET}\n") + print( + f"{CYAN}{BOLD}╚════════════════════════════════════════════════════╝{RESET}\n" + ) if session_history: recent = list(session_history.keys())[-5:] @@ -66,7 +67,6 @@ def view_debug_log(): pause() - def view_stats_and_mastery(state_manager): clear_screen() session_history = state_manager.session_history @@ -101,6 +101,7 @@ def view_stats_and_mastery(state_manager): pause() + def factory_reset(state_manager): clear_screen() print(f"{RED}★ Factory Reset ★{RESET}\n") @@ -195,14 +196,25 @@ def manage_imports(state_manager): print(f" • {badge} {CYAN}{BOLD}{cmd}{RESET}: {short_desc}") print(f"\n{YELLOW}Options:{RESET}") - print(f" - Type a command name (or comma-separated list) to {RED}DELETE{RESET} from the database.") + print( + f" - Type a command name (or comma-separated list) to {RED}DELETE{RESET} from the database." + ) print(f" - Type {RED}all{RESET} to clear all custom imports.") print(" - Press Enter to return to the menu.") choice = input(f"\n{GREEN}➜ {RESET}").strip().lower() if choice == "all": - confirm = input(f"{RED}Are you sure you want to delete ALL custom imports? (y/n): {RESET}").strip().lower() - if confirm == 'y': + try: + confirm = ( + input( + f"{RED}Are you sure you want to delete ALL custom imports? (y/n): {RESET}" + ) + .strip() + .lower() + ) + except (KeyboardInterrupt, EOFError): + confirm = "n" + if confirm == "y": custom_guide.clear() state_manager.save_custom() print(f"{YELLOW}Successfully deleted all custom imports.{RESET}")