rbt diff command allows users to get a preview of the diff that will be posted when they run
It would be nice, when running on a supporting terminal, to apply some basic colorization of the output (in much the same way that
git diff will highlight removed lines in red and added lines in green).
For this, you will want to evaluate the Pygments library, which provides syntax highlighting.
I'm pleased to report that this feature is nearly completed. David and Christian have reviewed it, and all of the issues they reported on the review request have been addressed. Christian suggested adding support for pydiffx's
pydiffx.integrations.pygments lexer.DiffXLexer.DiffXLexer. I've added support for pydiffx and written test cases. However, David and Christian will need to review it to ensure that nothing is missing or overlooked.
The review request can be found here.
Overview of the changes:
Diff.colorize_diff: Formats the diff with basic colorization.
rbt diffwith various arguments for
Diff.colorize_diffusing a unified diff.
_capture_sys_output: Context manager to capture the sys.stderr