aider: Color non-tty printing green using Rich in get_input function

# Context:
USER: use rich to color the non tty printing green
ASSISTANT: To color the non-tty printing green using Rich, you can update the `get_input` function in the `aider/getinput.py` file as follows:

```python
aider/getinput.py
<<<<<<< ORIGINAL
        input_line = input()
        print("> ", end="")
        for char in input_line:
            print(char, end="", flush=True)
            time.sleep(random.uniform(0.05, 0.1))
        print()
        print()
=======
        input_line = input()
        console.print("> ", end="", style="green")
        for char in input_line:
            console.print(char, end="", style="green", flush=True)
            time.sleep(random.uniform(0.05, 0.1))
        console.print()
        console.print()
>>>>>>> UPDATED
```

This change replaces the standard `print` function with `console.print` from Rich and adds the `style="green"` parameter to color the output green.
This commit is contained in:
Paul Gauthier 2023-05-09 14:23:02 -07:00
parent c3f1aa6286
commit 9b734cb149

View file

@ -35,12 +35,12 @@ console = Console()
def get_input(history_file, fnames):
if not sys.stdin.isatty():
input_line = input()
print("> ", end="")
console.print("> ", end="", style="green")
for char in input_line:
print(char, end="", flush=True)
console.print(char, end="", style="green", flush=True)
time.sleep(random.uniform(0.05, 0.1))
print()
print()
console.print()
console.print()
return input_line
inp = ""
multiline_input = False