talonvoice / talon

Issue Tracker for the main Talon app
85 stars 0 forks source link

Enhanced talon REPL with color output. #417

Open Nova38 opened 3 years ago

Nova38 commented 3 years ago

Potential utilizes a library like rich (https://rich.readthedocs.io/en/latest/protocol.html) to enhance the output of the REPL to make scripting development easier to do by colorizing it. It has a command to auto color the output of a REPL via the pretty.install() call. It also includes a better inspect function those outputs much cleaner debugging output.

I currently can get it to mostly work by importing and running the following commands but including it on the backend would stop it having to be manually typed in every time.

from rich.console import Console
from rich import pretty
from rich import inspect

con = Console(color_system="truecolor",force_terminal=True)
pretty.install(console=con)
Nova38 commented 2 years ago

The above code no longer works. It now generates the following error. "ValueError: bad file descriptor".

The root of the error is the get_terminal_size() function from the OS module.

So after some testing that error was on rich 10.16. Rich 10.12 is still working. So if anyone wants to use rich they should make sure the installed version is 10.12 (other versions may work but the current release dosn't)