Skip to content

Conversation

Alonely0
Copy link

@Alonely0 Alonely0 commented Sep 25, 2025

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

Specifically, add a hidden Easter egg that makes it behave like the notorious `lolcat` if the `--lol` flag is passed.
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)

Fix CI problems
@cakebaker
Copy link
Contributor

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).
@Alonely0
Copy link
Author

Alonely0 commented Sep 25, 2025

While it looks nice, I don't see the benefit of adding such a feature.

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, lolcat could not keep up with the output rate of sl (nor a few escape codes), resulting in the train losing its lower half.

Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/stdbuf (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

Copy link

codspeed-hq bot commented Sep 25, 2025

CodSpeed Performance Report

Merging #8741 will not alter performance

Comparing Alonely0:main (1cffdcb) with main (5efafd6)

Summary

✅ 55 untouched
⏩ 1 skipped1

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

The algorithm is now a minimum taxicab distance.
@Alonely0
Copy link
Author

Alonely0 commented Sep 25, 2025

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?

Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants