Textualize / rich

Rich is a Python library for rich text and beautiful formatting in the terminal.
https://rich.readthedocs.io/en/latest/
MIT License
48.13k stars 1.69k forks source link

[REQUEST] Diff Tool Enhanced #3303

Open onlyacat opened 3 months ago

onlyacat commented 3 months ago

How would you improve Rich?

It is easy to diff two files or two texts and receive highlighting results in the terminal with tools like diff or git-diff. But it is hard to finish during the python process. Even though Python provides a native library called difflib, still it is a long way to go to print the result in the console simply.

I would like to know will the rich support this function.

What problem does it solve for you? This could simply be the whole process with fewer libraries and the diff results can be reorganized with the whole pipeline. Thus the result can be printed easily by rich.Console. The whole process may be like:

import rich

a = "123"
b = "1234"

rich.print(rich.diff(a,b))

Also, it can be invoked in the terminal. Like:

python3 -m rich.diff t1.txt t2.txt
github-actions[bot] commented 3 months ago

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory