From c1642b5ecae4fc98b862844f236145f0d56ee975 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Sat, 28 Sep 2024 15:02:09 -0700 Subject: [PATCH] feat: add "Never" option to confirm_ask and store user choices in never_prompts set --- aider/io.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/aider/io.py b/aider/io.py index 10b4a5e68..1495e663f 100644 --- a/aider/io.py +++ b/aider/io.py @@ -198,6 +198,7 @@ class InputOutput: llm_history_file=None, editingmode=EditingMode.EMACS, ): + self.never_prompts = set() self.editingmode = editingmode no_color = os.environ.get("NO_COLOR") if no_color is not None and no_color != "": @@ -482,10 +483,13 @@ class InputOutput: self.append_chat_history(hist) 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 + if question in self.never_prompts: + return False + if group and not group.show_group: group = None @@ -497,6 +501,9 @@ class InputOutput: valid_responses.append("all") options += "/(S)kip all" valid_responses.append("skip") + if allow_never: + options += "/(X)Never" + valid_responses.append("never") question += options + " [Yes]: " if subject: @@ -547,6 +554,12 @@ class InputOutput: 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: is_yes = res == "y" else: