mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 08:44:59 +00:00
aider: Created a new function confirm_ask
in the Coder
class and replaced all calls to Confirm.ask
with the new function.
# Context: USER: make a new func self.confirm_ask which just calls Confirm.ask and returns the result. change all calls to use it. ASSISTANT: I will create a new function `confirm_ask` in the `Coder` class and replace all calls to `Confirm.ask` with the new function. ```python aider/coder.py <<<<<<< ORIGINAL class Coder: abs_fnames = set() ======= class Coder: abs_fnames = set() def confirm_ask(self, question, default="y"): return Confirm.ask(question, console=self.console, default=default) >>>>>>> UPDATED aider/coder.py <<<<<<< ORIGINAL if Confirm.ask("[bright_black]Add them?", console=self.console, default="y"): ======= if self.confirm_ask("[bright_black]Add them?"): >>>>>>> UPDATED aider/coder.py <<<<<<< ORIGINAL if Confirm.ask("[bright_black]Add {path} to git?", console=self.console, default="y"): ======= if self.confirm_ask("[bright_black]Add {path} to git?"): >>>>>>> UPDATED aider/coder.py <<<<<<< ORIGINAL ok = Confirm.ask("[bright_black]Add these files?", console=self.console, default="y") ======= ok = self.confirm_ask("[bright_black]Add these files?") >>>>>>> UPDATED ```
This commit is contained in:
parent
0dd35cdaee
commit
34c2369380
1 changed files with 5 additions and 2 deletions
|
@ -30,6 +30,9 @@ openai.api_key = os.getenv("OPENAI_API_KEY")
|
||||||
class Coder:
|
class Coder:
|
||||||
abs_fnames = set()
|
abs_fnames = set()
|
||||||
|
|
||||||
|
def confirm_ask(self, question, default="y"):
|
||||||
|
return Confirm.ask(question, console=self.console, default=default)
|
||||||
|
|
||||||
repo = None
|
repo = None
|
||||||
last_aider_commit_hash = None
|
last_aider_commit_hash = None
|
||||||
|
|
||||||
|
@ -117,7 +120,7 @@ class Coder:
|
||||||
self.console.print(f"[bright_black]Files not tracked in {repo.git_dir}:")
|
self.console.print(f"[bright_black]Files not tracked in {repo.git_dir}:")
|
||||||
for fn in new_files:
|
for fn in new_files:
|
||||||
self.console.print(f"[bright_black] {fn}")
|
self.console.print(f"[bright_black] {fn}")
|
||||||
if Confirm.ask("[bright_black]Add them?", console=self.console, default="y"):
|
if self.confirm_ask("[bright_black]Add them?"):
|
||||||
for relative_fname in new_files:
|
for relative_fname in new_files:
|
||||||
repo.git.add(relative_fname)
|
repo.git.add(relative_fname)
|
||||||
self.console.print(f"[bright_black]Added {relative_fname} to the git repo")
|
self.console.print(f"[bright_black]Added {relative_fname} to the git repo")
|
||||||
|
@ -305,7 +308,7 @@ class Coder:
|
||||||
|
|
||||||
for rel_fname in mentioned_rel_fnames:
|
for rel_fname in mentioned_rel_fnames:
|
||||||
self.console.print(f"[bright_black]{rel_fname}")
|
self.console.print(f"[bright_black]{rel_fname}")
|
||||||
ok = Confirm.ask("[bright_black]Add these files?", console=self.console, default="y")
|
if self.confirm_ask("[bright_black]Add {path} to git?"):
|
||||||
if not ok:
|
if not ok:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue