mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 09:14:59 +00:00
fix: Add ConfirmGroup to confirm file and shell command additions
This commit is contained in:
parent
b26550d93f
commit
668ab7e204
1 changed files with 8 additions and 4 deletions
|
@ -1252,7 +1252,8 @@ class Coder:
|
|||
return
|
||||
|
||||
add_files = "\n".join(mentioned_rel_fnames) + "\n"
|
||||
if not self.io.confirm_ask("Add these files to the chat?", subject=add_files):
|
||||
group = ConfirmGroup(mentioned_rel_fnames)
|
||||
if not self.io.confirm_ask("Add these files to the chat?", subject=add_files, group=group):
|
||||
return
|
||||
|
||||
for rel_fname in mentioned_rel_fnames:
|
||||
|
@ -1811,19 +1812,22 @@ class Coder:
|
|||
|
||||
def run_shell_commands(self):
|
||||
done = set()
|
||||
group = ConfirmGroup(set(self.shell_commands))
|
||||
for command in self.shell_commands:
|
||||
if command in done:
|
||||
continue
|
||||
done.add(command)
|
||||
self.handle_shell_commands(command)
|
||||
self.handle_shell_commands(command, group)
|
||||
|
||||
def handle_shell_commands(self, commands_str):
|
||||
def handle_shell_commands(self, commands_str, group):
|
||||
commands = commands_str.strip().splitlines()
|
||||
command_count = sum(
|
||||
1 for cmd in commands if cmd.strip() and not cmd.strip().startswith("#")
|
||||
)
|
||||
prompt = "Run shell command?" if command_count == 1 else "Run shell commands?"
|
||||
if not self.io.confirm_ask(prompt, subject="\n".join(commands), explicit_yes_required=True):
|
||||
if not self.io.confirm_ask(
|
||||
prompt, subject="\n".join(commands), explicit_yes_required=True, group=group
|
||||
):
|
||||
return
|
||||
|
||||
for command in commands:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue