mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-02 10:45:00 +00:00
feat: add "Never" option to confirm_ask and store user choices in never_prompts set
This commit is contained in:
parent
f8746feaa1
commit
c1642b5eca
1 changed files with 14 additions and 1 deletions
15
aider/io.py
15
aider/io.py
|
@ -198,6 +198,7 @@ class InputOutput:
|
||||||
llm_history_file=None,
|
llm_history_file=None,
|
||||||
editingmode=EditingMode.EMACS,
|
editingmode=EditingMode.EMACS,
|
||||||
):
|
):
|
||||||
|
self.never_prompts = set()
|
||||||
self.editingmode = editingmode
|
self.editingmode = editingmode
|
||||||
no_color = os.environ.get("NO_COLOR")
|
no_color = os.environ.get("NO_COLOR")
|
||||||
if no_color is not None and no_color != "":
|
if no_color is not None and no_color != "":
|
||||||
|
@ -482,10 +483,13 @@ class InputOutput:
|
||||||
self.append_chat_history(hist)
|
self.append_chat_history(hist)
|
||||||
|
|
||||||
def confirm_ask(
|
def confirm_ask(
|
||||||
self, question, default="y", subject=None, explicit_yes_required=False, group=None
|
self, question, default="y", subject=None, explicit_yes_required=False, group=None, allow_never=False
|
||||||
):
|
):
|
||||||
self.num_user_asks += 1
|
self.num_user_asks += 1
|
||||||
|
|
||||||
|
if question in self.never_prompts:
|
||||||
|
return False
|
||||||
|
|
||||||
if group and not group.show_group:
|
if group and not group.show_group:
|
||||||
group = None
|
group = None
|
||||||
|
|
||||||
|
@ -497,6 +501,9 @@ class InputOutput:
|
||||||
valid_responses.append("all")
|
valid_responses.append("all")
|
||||||
options += "/(S)kip all"
|
options += "/(S)kip all"
|
||||||
valid_responses.append("skip")
|
valid_responses.append("skip")
|
||||||
|
if allow_never:
|
||||||
|
options += "/(X)Never"
|
||||||
|
valid_responses.append("never")
|
||||||
question += options + " [Yes]: "
|
question += options + " [Yes]: "
|
||||||
|
|
||||||
if subject:
|
if subject:
|
||||||
|
@ -547,6 +554,12 @@ class InputOutput:
|
||||||
|
|
||||||
res = res.lower()[0]
|
res = res.lower()[0]
|
||||||
|
|
||||||
|
if res == 'x' and allow_never:
|
||||||
|
self.never_prompts.add(question)
|
||||||
|
hist = f"{question.strip()} {res}"
|
||||||
|
self.append_chat_history(hist, linebreak=True, blockquote=True)
|
||||||
|
return False
|
||||||
|
|
||||||
if explicit_yes_required:
|
if explicit_yes_required:
|
||||||
is_yes = res == "y"
|
is_yes = res == "y"
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue