From 073ad453e739b49a604faa8c0578c6afcd06d189 Mon Sep 17 00:00:00 2001 From: Dave Hulbert Date: Sun, 3 Dec 2023 20:47:03 +0000 Subject: [PATCH] Handle ctrl-c by aborting Fixes #26 --- clipea/__main__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/clipea/__main__.py b/clipea/__main__.py index eef29d9..26ab5ec 100644 --- a/clipea/__main__.py +++ b/clipea/__main__.py @@ -15,7 +15,12 @@ def clipea_main() -> None: sys.exit('Error: dependency "llm" not found. Run "clipea setup" to install') user_prompt = " ".join(sys.argv[1:]) - router.commands_router(user_prompt) + + try: + router.commands_router(user_prompt) + except KeyboardInterrupt: + print("\nAborted!") + sys.exit(1) if __name__ == "__main__":