mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 14:55:00 +00:00
Ask to add /run output to the chat
This commit is contained in:
parent
0ade98dfff
commit
a525a1b543
2 changed files with 26 additions and 3 deletions
|
@ -13,7 +13,7 @@ class Commands:
|
|||
self.coder = coder
|
||||
|
||||
def is_command(self, inp):
|
||||
if inp[0] == '/':
|
||||
if inp[0] == "/":
|
||||
return True
|
||||
|
||||
def help(self):
|
||||
|
@ -230,12 +230,25 @@ class Commands:
|
|||
"Run the supplied command in a subprocess and combine stdout and stderr into a single string"
|
||||
try:
|
||||
parsed_args = shlex.split(args)
|
||||
result = subprocess.run(parsed_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
|
||||
result = subprocess.run(
|
||||
parsed_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True
|
||||
)
|
||||
combined_output = result.stdout
|
||||
print(combined_output)
|
||||
except Exception as e:
|
||||
self.io.tool_error(f"Error running command: {e}")
|
||||
|
||||
print(combined_output)
|
||||
|
||||
ok = Confirm.ask("Add the output to the chat?", default="y")
|
||||
if not ok:
|
||||
return
|
||||
|
||||
msg = prompts.run_output.format(
|
||||
command=args,
|
||||
output=combined_output,
|
||||
)
|
||||
return msg
|
||||
|
||||
def cmd_ls(self, args):
|
||||
"List all known files and those included in the chat session"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue