mirror of
https://github.com/Aider-AI/aider.git
synced 2025-12-23 08:48:18 +00:00
#72: Add global command prefix
This commit is contained in:
parent
86f3a992bd
commit
be9b026ce2
4 changed files with 16 additions and 0 deletions
|
|
@ -965,6 +965,11 @@ def get_parser(default_config_files, git_root):
|
|||
" specified, a default command for your OS may be used."
|
||||
),
|
||||
)
|
||||
group.add_argument(
|
||||
"--command-prefix",
|
||||
default=None,
|
||||
help="Specify a command prefix for all commands (useful for sandboxing)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--detect-urls",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
|
|
|
|||
|
|
@ -3837,6 +3837,10 @@ class Coder:
|
|||
if not command or command.startswith("#"):
|
||||
continue
|
||||
|
||||
if command and getattr(self.args, "command_prefix", None):
|
||||
command_prefix = getattr(self.args, "command_prefix", None)
|
||||
command = f"{command_prefix} {command}"
|
||||
|
||||
self.io.tool_output()
|
||||
self.io.tool_output(f"Running {command}")
|
||||
# Add the command to input history
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ class Tool(BaseTool):
|
|||
# Ask for confirmation before executing.
|
||||
# allow_never=True enables the 'Always' option.
|
||||
# confirm_ask handles remembering the 'Always' choice based on the subject.
|
||||
if command_string and getattr(coder.args, "command_prefix", None):
|
||||
command_prefix = getattr(coder.args, "command_prefix", None)
|
||||
command_string = f"{command_prefix} {command_string}"
|
||||
|
||||
confirmed = (
|
||||
True
|
||||
|
|
|
|||
|
|
@ -31,6 +31,10 @@ class Tool(BaseTool):
|
|||
Execute an interactive shell command using run_cmd (which uses pexpect/PTY).
|
||||
"""
|
||||
try:
|
||||
if command_string and getattr(coder.args, "command_prefix", None):
|
||||
command_prefix = getattr(coder.args, "command_prefix", None)
|
||||
command_string = f"{command_prefix} {command_string}"
|
||||
|
||||
confirmed = (
|
||||
True
|
||||
if coder.skip_cli_confirmations
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue