aider: Added tool_color and tool_error_color properties to InputOutput class and updated style and console print accordingly.

# Context:
USER: move the red and green colors for tool and tool_error into self. properties. add args to init with red and green defaults.
ASSISTANT: To make the changes, I will modify the `aider/io.py` file. Here are the changes:

```python
aider/io.py
<<<<<<< ORIGINAL
class InputOutput:
    def __init__(
        self,
        pretty=True,
        yes=False,
        input_history_file=None,
        chat_history_file=None,
        input=None,
        output=None,
    ):
=======
class InputOutput:
    def __init__(
        self,
        pretty=True,
        yes=False,
        input_history_file=None,
        chat_history_file=None,
        input=None,
        output=None,
        tool_color="green",
        tool_error_color="red",
    ):
        self.tool_color = tool_color
        self.tool_error_color = tool_error_color
>>>>>>> UPDATED
```

```python
aider/io.py
<<<<<<< ORIGINAL
        style = Style.from_dict({"": "green"})
=======
        style = Style.from_dict({"": self.tool_color})
>>>>>>> UPDATED
```

```python
aider/io.py
<<<<<<< ORIGINAL
        self.console.print(message, style="red")
=======
        self.console.print(message, style=self.tool_error_color)
>>>>>>> UPDATED
```
This commit is contained in:
Paul Gauthier 2023-05-27 14:54:04 -07:00
parent 387477d5c2
commit 03cc679a5b

View file

@ -82,7 +82,11 @@ class InputOutput:
chat_history_file=None,
input=None,
output=None,
tool_color="green",
tool_error_color="red",
):
self.tool_color = tool_color
self.tool_error_color = tool_error_color
self.input = input
self.output = output
self.pretty = pretty
@ -116,7 +120,7 @@ class InputOutput:
inp = ""
multiline_input = False
style = Style.from_dict({"": "green"})
style = Style.from_dict({"": self.tool_color})
while True:
completer_instance = FileContentCompleter(
@ -203,7 +207,7 @@ class InputOutput:
self.append_chat_history(hist, linebreak=True, blockquote=True)
message = Text(message)
self.console.print(message, style="red")
self.console.print(message, style=self.tool_error_color)
def tool(self, *messages, log_only=False):
if messages: