mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
Merge b8e46f2d04
into 3caab85931
This commit is contained in:
commit
e1a1bbd187
6 changed files with 37 additions and 15 deletions
|
@ -327,6 +327,11 @@ def get_parser(default_config_files, git_root):
|
||||||
default="#00cc00",
|
default="#00cc00",
|
||||||
help="Set the color for user input (default: #00cc00)",
|
help="Set the color for user input (default: #00cc00)",
|
||||||
)
|
)
|
||||||
|
group.add_argument(
|
||||||
|
"--user-input-submitted-color",
|
||||||
|
default=None,
|
||||||
|
help="Set the color for user submitted input (default: #00cc00)",
|
||||||
|
)
|
||||||
group.add_argument(
|
group.add_argument(
|
||||||
"--tool-output-color",
|
"--tool-output-color",
|
||||||
default=None,
|
default=None,
|
||||||
|
|
28
aider/io.py
28
aider/io.py
|
@ -243,6 +243,7 @@ class InputOutput:
|
||||||
input=None,
|
input=None,
|
||||||
output=None,
|
output=None,
|
||||||
user_input_color="blue",
|
user_input_color="blue",
|
||||||
|
user_input_submitted_color=None,
|
||||||
tool_output_color=None,
|
tool_output_color=None,
|
||||||
tool_error_color="red",
|
tool_error_color="red",
|
||||||
tool_warning_color="#FFA500",
|
tool_warning_color="#FFA500",
|
||||||
|
@ -281,6 +282,9 @@ class InputOutput:
|
||||||
pretty = False
|
pretty = False
|
||||||
|
|
||||||
self.user_input_color = ensure_hash_prefix(user_input_color) if pretty else None
|
self.user_input_color = ensure_hash_prefix(user_input_color) if pretty else None
|
||||||
|
self.user_input_submitted_color = (
|
||||||
|
ensure_hash_prefix(user_input_submitted_color) if pretty else None
|
||||||
|
)
|
||||||
self.tool_output_color = ensure_hash_prefix(tool_output_color) if pretty else None
|
self.tool_output_color = ensure_hash_prefix(tool_output_color) if pretty else None
|
||||||
self.tool_error_color = ensure_hash_prefix(tool_error_color) if pretty else None
|
self.tool_error_color = ensure_hash_prefix(tool_error_color) if pretty else None
|
||||||
self.tool_warning_color = ensure_hash_prefix(tool_warning_color) if pretty else None
|
self.tool_warning_color = ensure_hash_prefix(tool_warning_color) if pretty else None
|
||||||
|
@ -343,6 +347,7 @@ class InputOutput:
|
||||||
"output": self.output,
|
"output": self.output,
|
||||||
"lexer": PygmentsLexer(MarkdownLexer),
|
"lexer": PygmentsLexer(MarkdownLexer),
|
||||||
"editing_mode": self.editingmode,
|
"editing_mode": self.editingmode,
|
||||||
|
"erase_when_done": True,
|
||||||
}
|
}
|
||||||
if self.editingmode == EditingMode.VI:
|
if self.editingmode == EditingMode.VI:
|
||||||
session_kwargs["cursor"] = ModalCursorShapeConfig()
|
session_kwargs["cursor"] = ModalCursorShapeConfig()
|
||||||
|
@ -369,6 +374,7 @@ class InputOutput:
|
||||||
"""Validate configured color strings and reset invalid ones."""
|
"""Validate configured color strings and reset invalid ones."""
|
||||||
color_attributes = [
|
color_attributes = [
|
||||||
"user_input_color",
|
"user_input_color",
|
||||||
|
"user_input_submitted_color",
|
||||||
"tool_output_color",
|
"tool_output_color",
|
||||||
"tool_error_color",
|
"tool_error_color",
|
||||||
"tool_warning_color",
|
"tool_warning_color",
|
||||||
|
@ -501,11 +507,11 @@ class InputOutput:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def rule(self):
|
def rule(self):
|
||||||
if self.pretty:
|
if not self.pretty:
|
||||||
style = dict(style=self.user_input_color) if self.user_input_color else dict()
|
return "\n"
|
||||||
self.console.rule(**style)
|
|
||||||
else:
|
columns = self.console.width
|
||||||
print()
|
return "\n".join(["─" * columns, ""])
|
||||||
|
|
||||||
def interrupt_input(self):
|
def interrupt_input(self):
|
||||||
if self.prompt_session and self.prompt_session.app:
|
if self.prompt_session and self.prompt_session.app:
|
||||||
|
@ -523,18 +529,16 @@ class InputOutput:
|
||||||
abs_read_only_fnames=None,
|
abs_read_only_fnames=None,
|
||||||
edit_format=None,
|
edit_format=None,
|
||||||
):
|
):
|
||||||
self.rule()
|
|
||||||
|
|
||||||
# Ring the bell if needed
|
# Ring the bell if needed
|
||||||
self.ring_bell()
|
self.ring_bell()
|
||||||
|
|
||||||
rel_fnames = list(rel_fnames)
|
rel_fnames = list(rel_fnames)
|
||||||
show = ""
|
show = self.rule()
|
||||||
if rel_fnames:
|
if rel_fnames:
|
||||||
rel_read_only_fnames = [
|
rel_read_only_fnames = [
|
||||||
get_rel_fname(fname, root) for fname in (abs_read_only_fnames or [])
|
get_rel_fname(fname, root) for fname in (abs_read_only_fnames or [])
|
||||||
]
|
]
|
||||||
show = self.format_files_for_input(rel_fnames, rel_read_only_fnames)
|
show += self.format_files_for_input(rel_fnames, rel_read_only_fnames)
|
||||||
|
|
||||||
prompt_prefix = ""
|
prompt_prefix = ""
|
||||||
if edit_format:
|
if edit_format:
|
||||||
|
@ -658,6 +662,7 @@ class InputOutput:
|
||||||
complete_while_typing=True,
|
complete_while_typing=True,
|
||||||
prompt_continuation=get_continuation,
|
prompt_continuation=get_continuation,
|
||||||
)
|
)
|
||||||
|
self.display_user_input(show + line)
|
||||||
else:
|
else:
|
||||||
line = input(show)
|
line = input(show)
|
||||||
|
|
||||||
|
@ -754,8 +759,8 @@ class InputOutput:
|
||||||
log_file.write(content + "\n")
|
log_file.write(content + "\n")
|
||||||
|
|
||||||
def display_user_input(self, inp):
|
def display_user_input(self, inp):
|
||||||
if self.pretty and self.user_input_color:
|
if self.pretty and self.user_input_submitted_color:
|
||||||
style = dict(style=self.user_input_color)
|
style = dict(style=self.user_input_submitted_color)
|
||||||
else:
|
else:
|
||||||
style = dict()
|
style = dict()
|
||||||
|
|
||||||
|
@ -868,6 +873,7 @@ class InputOutput:
|
||||||
style=style,
|
style=style,
|
||||||
complete_while_typing=False,
|
complete_while_typing=False,
|
||||||
)
|
)
|
||||||
|
self.display_user_input(question + res)
|
||||||
else:
|
else:
|
||||||
res = input(question)
|
res = input(question)
|
||||||
except EOFError:
|
except EOFError:
|
||||||
|
|
|
@ -557,6 +557,7 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
||||||
input=input,
|
input=input,
|
||||||
output=output,
|
output=output,
|
||||||
user_input_color=args.user_input_color,
|
user_input_color=args.user_input_color,
|
||||||
|
user_input_submitted_color=args.user_input_submitted_color,
|
||||||
tool_output_color=args.tool_output_color,
|
tool_output_color=args.tool_output_color,
|
||||||
tool_warning_color=args.tool_warning_color,
|
tool_warning_color=args.tool_warning_color,
|
||||||
tool_error_color=args.tool_error_color,
|
tool_error_color=args.tool_error_color,
|
||||||
|
|
|
@ -173,6 +173,9 @@
|
||||||
## Set the color for user input (default: #00cc00)
|
## Set the color for user input (default: #00cc00)
|
||||||
#user-input-color: "#00cc00"
|
#user-input-color: "#00cc00"
|
||||||
|
|
||||||
|
## Set the color for user submitted input (default: None)
|
||||||
|
#user-input-submitted-color: "xxx"
|
||||||
|
|
||||||
## Set the color for tool output (default: None)
|
## Set the color for tool output (default: None)
|
||||||
#tool-output-color: "xxx"
|
#tool-output-color: "xxx"
|
||||||
|
|
||||||
|
|
|
@ -202,6 +202,9 @@ cog.outl("```")
|
||||||
## Set the color for user input (default: #00cc00)
|
## Set the color for user input (default: #00cc00)
|
||||||
#AIDER_USER_INPUT_COLOR=#00cc00
|
#AIDER_USER_INPUT_COLOR=#00cc00
|
||||||
|
|
||||||
|
## Set the color for user submitted input (default: #00cc00)
|
||||||
|
#AIDER_USER_INPUT_SUBMITTED_COLOR=
|
||||||
|
|
||||||
## Set the color for tool output (default: None)
|
## Set the color for tool output (default: None)
|
||||||
#AIDER_TOOL_OUTPUT_COLOR=
|
#AIDER_TOOL_OUTPUT_COLOR=
|
||||||
|
|
||||||
|
|
|
@ -42,10 +42,10 @@ usage: aider [-h] [--model] [--openai-api-key] [--anthropic-api-key]
|
||||||
[--restore-chat-history | --no-restore-chat-history]
|
[--restore-chat-history | --no-restore-chat-history]
|
||||||
[--llm-history-file] [--dark-mode] [--light-mode]
|
[--llm-history-file] [--dark-mode] [--light-mode]
|
||||||
[--pretty | --no-pretty] [--stream | --no-stream]
|
[--pretty | --no-pretty] [--stream | --no-stream]
|
||||||
[--user-input-color] [--tool-output-color]
|
[--user-input-color] [--user-input-submitted-color]
|
||||||
[--tool-error-color] [--tool-warning-color]
|
[--tool-output-color] [--tool-error-color]
|
||||||
[--assistant-output-color] [--completion-menu-color]
|
[--tool-warning-color] [--assistant-output-color]
|
||||||
[--completion-menu-bg-color]
|
[--completion-menu-color] [--completion-menu-bg-color]
|
||||||
[--completion-menu-current-color]
|
[--completion-menu-current-color]
|
||||||
[--completion-menu-current-bg-color] [--code-theme]
|
[--completion-menu-current-bg-color] [--code-theme]
|
||||||
[--show-diffs] [--git | --no-git]
|
[--show-diffs] [--git | --no-git]
|
||||||
|
@ -325,6 +325,10 @@ Set the color for user input (default: #00cc00)
|
||||||
Default: #00cc00
|
Default: #00cc00
|
||||||
Environment variable: `AIDER_USER_INPUT_COLOR`
|
Environment variable: `AIDER_USER_INPUT_COLOR`
|
||||||
|
|
||||||
|
### `--user-input-submitted-color VALUE`
|
||||||
|
Set the color for user submitted input (default: None)
|
||||||
|
Environment variable: `AIDER_USER_INPUT_SUBMITTED_COLOR`
|
||||||
|
|
||||||
### `--tool-output-color VALUE`
|
### `--tool-output-color VALUE`
|
||||||
Set the color for tool output (default: None)
|
Set the color for tool output (default: None)
|
||||||
Environment variable: `AIDER_TOOL_OUTPUT_COLOR`
|
Environment variable: `AIDER_TOOL_OUTPUT_COLOR`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue