mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 16:25:00 +00:00
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:
parent
c3f1aa6286
commit
9b734cb149
1 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue