From 07f022267e636f8ae53f77f19db78c01912f0eaf Mon Sep 17 00:00:00 2001 From: Bastian Fredriksson Date: Sun, 16 Jun 2024 19:50:05 +0200 Subject: [PATCH] fix: do not error out when pressing ctrl+c --- src/fish_ai/switch_context.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/fish_ai/switch_context.py b/src/fish_ai/switch_context.py index ad8c8db..cc7b6fd 100644 --- a/src/fish_ai/switch_context.py +++ b/src/fish_ai/switch_context.py @@ -18,6 +18,8 @@ def switch_context(): terminal_menu = TerminalMenu(options) terminal_menu.title = 'Select context' index = terminal_menu.show() + if index is None: + return active_section = options[index].split(' ')[0] config.set(section='fish-ai', option='configuration', value=active_section) config.write(open(path.expanduser('~/.config/fish-ai.ini'), 'w'))