Skip to content

Commit

Permalink
fix: fixed auto n option on ask_execute, added log message with rem…
Browse files Browse the repository at this point in the history
…aining skips
  • Loading branch information
ErikBjare committed Dec 21, 2024
1 parent 871cf63 commit cc1af13
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions gptme/util/ask_execute.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit cc1af13

Please sign in to comment.