-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
cat: add colorization functionality #8741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Specifically, add a hidden Easter egg that makes it behave like the notorious `lolcat` if the `--lol` flag is passed.
GNU testsuite comparison:
|
Fix CI problems
While it looks nice, I don't see the benefit of adding such a feature. |
Fix CI (on my end; there are clippy errors outside of my scope, but that's another commit/PR).
Yeah, it's silly, but this is what makes Open Source fun and with a soul; I did DM Sylvestre first, and he was chill with adding this. I guess the main benefit is that this implementation is much faster and reliable than the original, mostly because uutils' cat is quite well implemented, and I could easily build on top of that. One example of a big improvement due to performance is that, on my machine, |
GNU testsuite comparison:
|
CodSpeed Performance ReportMerging #8741 will not alter performanceComparing Summary
Footnotes
|
The algorithm is now a minimum taxicab distance.
Well, if CI likes this last commit, I consider this finished. Let me know if you would like any changes done, or if you would prefer me to squash this into a single commit or to rebase to latest main before merging it. EDIT: Should I bother fixing the cspell errors? |
GNU testsuite comparison:
|
This PR adds an Easter egg to cat that colorizes the output in a gradient in homage to the notorious
lolcat
, accessible via the--lol
flag. This feature has been implemented as a wrapper over the default writer used only to print the contents of each line, ensuring compatibility with other flags or input types. Furthermore, it takes care of not breaking detectable escape sequences and automatically detects the color space of the terminal used; these are both added functionality and/or improvements over the Rust lolcat implementation, which does not handle ANSI 8-bit color space and has trouble with some obscure flags.Here is a video demonstration, heavily compressed by GitHub for your (in)convenience:
Screencast.From.2025-09-25.02-36-52.mp4