diff --git a/src/libdib/repl.py b/src/libdib/repl.py index 1b5c8a8..2642505 100644 --- a/src/libdib/repl.py +++ b/src/libdib/repl.py @@ -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