From 625fd1c3a5da23190a48f1fa46bdd41f799cb8d3 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 11 May 2023 17:46:05 -0700 Subject: [PATCH] aider: Created new function `prompt_ask` in `Coder` class and replaced all calls to `Prompt.ask` with the new function. # Context: USER: make a new func self.prompt_ask which just calls Prompt.ask and returns the result. change all calls to use it. ASSISTANT: I will create a new function `prompt_ask` in the `Coder` class and replace all calls to `Prompt.ask` with the new function. ```python aider/coder.py <<<<<<< ORIGINAL class Coder: abs_fnames = set() def confirm_ask(self, question, default=None): ======= class Coder: abs_fnames = set() def confirm_ask(self, question, default=None): return Confirm.ask(question, console=self.console, default=default) def prompt_ask(self, question, default=None): return Prompt.ask(question, console=self.console, default=default) >>>>>>> UPDATED aider/coder.py <<<<<<< ORIGINAL res = Prompt.ask( ======= res = self.prompt_ask( >>>>>>> UPDATED "[bright_black]Commit before the chat proceeds? \[y/n/commit message]", # noqa: W605 E501 console=self.console, default="y", ).strip() ``` --- aider/coder.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/aider/coder.py b/aider/coder.py index c3b8801ed..763afc50d 100755 --- a/aider/coder.py +++ b/aider/coder.py @@ -33,6 +33,10 @@ class Coder: def confirm_ask(self, question, default=None): return Confirm.ask(question, console=self.console, default=default) + def prompt_ask(self, question, default=None): + return Prompt.ask(question, console=self.console, default=default) + return Confirm.ask(question, console=self.console, default=default) + repo = None last_aider_commit_hash = None @@ -517,7 +521,7 @@ class Coder: self.console.print("[bright_black]Files have uncommitted changes.\n") self.console.print(f"[bright_black]Suggested commit message:\n{commit_message}\n") - res = Prompt.ask( + res = self.prompt_ask( "[bright_black]Commit before the chat proceeds? \[y/n/commit message]", # noqa: W605 E501 console=self.console, default="y",