From b49c223a8c22f3166d2353d15f966cc6cdfdeb4b Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 9 Jun 2026 22:06:45 +0000 Subject: [PATCH 1/2] Feat: Add search to category view & bulk delete in manage imports Implements two UI enhancements in the dashboard: 1. Adds a prompt to search for commands directly from the category exploration view, reducing friction and menu navigation. 2. Updates the manage imports view to support deleting multiple custom imports via a comma-separated list, or clearing all imports with the 'all' command. Co-authored-by: MnemOnicE <170563909+MnemOnicE@users.noreply.github.com> --- commando/ui/dashboard.py | 43 +++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/commando/ui/dashboard.py b/commando/ui/dashboard.py index 7559d88..23aec91 100644 --- a/commando/ui/dashboard.py +++ b/commando/ui/dashboard.py @@ -141,7 +141,7 @@ def factory_reset(state_manager): pause() -def explore_category(state_manager): +def explore_category(state_manager, search_command_fn): all_known = state_manager.get_all_known_commands() categories = sorted(list(set(data["category"] for data in all_known.values()))) @@ -163,7 +163,16 @@ def explore_category(state_manager): for cmd, data in all_known.items(): if data["category"] == selected_cat: print(f" • {CYAN}{BOLD}{cmd}{RESET}: {data['desc']}") - pause() + + print(f"\n{YELLOW}Options:{RESET}") + print(f" - Type a command name to search for it.") + print(" - Press Enter to return to the menu.") + + search_choice = input(f"\n{GREEN}➜ {RESET}").strip() + if search_choice: + search_command_fn(search_choice.split()[0]) + else: + pause() else: print(f"{RED}Invalid selection.{RESET}") pause() @@ -188,17 +197,33 @@ 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 to {RED}DELETE{RESET} it 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 in custom_guide: - del custom_guide[choice] - save_json(CUSTOM_DICT_FILE, custom_guide) - print(f"{YELLOW}Successfully deleted '{choice}'.{RESET}") + 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': + custom_guide.clear() + save_json(CUSTOM_DICT_FILE, custom_guide) + print(f"{YELLOW}Successfully deleted all custom imports.{RESET}") pause() elif choice: - print(f"{RED}Command not found in custom imports.{RESET}") + deleted = [] + not_found = [] + for cmd in [c.strip() for c in choice.split(",") if c.strip()]: + if cmd in custom_guide: + del custom_guide[cmd] + deleted.append(cmd) + else: + not_found.append(cmd) + + if deleted: + save_json(CUSTOM_DICT_FILE, custom_guide) + print(f"{YELLOW}Successfully deleted: {', '.join(deleted)}{RESET}") + if not_found: + print(f"{RED}Not found in custom imports: {', '.join(not_found)}{RESET}") pause() @@ -430,7 +455,7 @@ def main_loop(state_manager, search_command_fn, auto_scan_fn): search_command_fn(cmd) continue elif raw_input == "2": - explore_category(state_manager) + explore_category(state_manager, search_command_fn) continue elif raw_input == "3": manage_imports(state_manager) From a87be7587a9928358563d8c11ace830275ca9020 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 9 Jun 2026 22:13:06 +0000 Subject: [PATCH 2/2] Fix: Address PR review comments - Remove redundant pause() in explore_category and lowercase search string - Use state_manager.save_custom() for encapsulation in manage_imports - Deduplicate user input list to prevent duplicate 'not found' errors Co-authored-by: MnemOnicE <170563909+MnemOnicE@users.noreply.github.com> --- commando/ui/dashboard.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/commando/ui/dashboard.py b/commando/ui/dashboard.py index 23aec91..894a07b 100644 --- a/commando/ui/dashboard.py +++ b/commando/ui/dashboard.py @@ -170,9 +170,7 @@ def explore_category(state_manager, search_command_fn): search_choice = input(f"\n{GREEN}➜ {RESET}").strip() if search_choice: - search_command_fn(search_choice.split()[0]) - else: - pause() + search_command_fn(search_choice.split()[0].lower()) else: print(f"{RED}Invalid selection.{RESET}") pause() @@ -206,13 +204,13 @@ def manage_imports(state_manager): confirm = input(f"{RED}Are you sure you want to delete ALL custom imports? (y/n): {RESET}").strip().lower() if confirm == 'y': custom_guide.clear() - save_json(CUSTOM_DICT_FILE, custom_guide) + state_manager.save_custom() print(f"{YELLOW}Successfully deleted all custom imports.{RESET}") pause() elif choice: deleted = [] not_found = [] - for cmd in [c.strip() for c in choice.split(",") if c.strip()]: + for cmd in dict.fromkeys(c.strip() for c in choice.split(",") if c.strip()): if cmd in custom_guide: del custom_guide[cmd] deleted.append(cmd) @@ -220,7 +218,7 @@ def manage_imports(state_manager): not_found.append(cmd) if deleted: - save_json(CUSTOM_DICT_FILE, custom_guide) + state_manager.save_custom() print(f"{YELLOW}Successfully deleted: {', '.join(deleted)}{RESET}") if not_found: print(f"{RED}Not found in custom imports: {', '.join(not_found)}{RESET}")