From cc1af13a0ac9c0011312135ee081b1064ebc8a59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Sat, 21 Dec 2024 16:23:24 +0100 Subject: [PATCH] fix: fixed `auto n` option on ask_execute, added log message with remaining skips --- gptme/util/ask_execute.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gptme/util/ask_execute.py b/gptme/util/ask_execute.py index fe640624..ef53a6bf 100644 --- a/gptme/util/ask_execute.py +++ b/gptme/util/ask_execute.py @@ -2,9 +2,9 @@ Utilities for asking user confirmation and handling editable/copiable content. """ +import re import sys import termios -import re from collections.abc import Callable, Generator from pathlib import Path @@ -95,6 +95,7 @@ def ask_execute(question="Execute code?", default=True) -> bool: if override_auto or auto_skip_count > 0: if auto_skip_count > 0: auto_skip_count -= 1 + console.log(f"Auto-skipping, {auto_skip_count} skips left") return True print_bell() # Ring the bell just before asking for input @@ -135,8 +136,8 @@ def ask_execute(question="Execute code?", default=True) -> bool: re_auto = r"auto(?:\s+(\d+))?" match = re.match(re_auto, answer) if match: - if match.group(2): - auto_skip_count = int(match.group(2)) + if num := match.group(1): + auto_skip_count = int(num) return True else: return (override_auto := True)