1 Commits

Author SHA1 Message Date
vegardbm f2b1e8fef8 InteractiveItemSelector: Allow quitting with 'q' 2026-05-30 22:49:36 +02:00
+3 -1
View File
@@ -34,7 +34,6 @@ def format_date(date: datetime) -> str:
InteractiveItemSelectorType = TypeVar("InteractiveItemSelectorType")
# TODO: We need a way to exit the selector without selecting an item, maybe by entering 'q' or something.
class InteractiveItemSelector(Generic[InteractiveItemSelectorType], Cmd):
sql_session: Session
execute_selection: Callable[[Session, type, str], list[Any]]
@@ -92,6 +91,9 @@ class InteractiveItemSelector(Generic[InteractiveItemSelectorType], Cmd):
print(f"Error executing selection: {e}")
if len(result) != 1:
if arg == "q":
self.result = None
return True
print(f"No such {self.cls.__name__} found: {arg}")
return