-
Notifications
You must be signed in to change notification settings - Fork 15
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
.ansi_color()
equivalent?
#105
Comments
There is AutoStream::choice which I sometimes use for some minor optimizations or interop with other libraries, like but you do have the right idea that where ever you can pass the |
Great — I'm trying that new approach in PRQL/prql#2773 now. My manual tests for printing to the terminal work well. But is there a recommended approach for tests? We have snapshot tests on the string representation of our errors. And they're trying to write a garbled mess :). For example, at https://github.com/PRQL/prql/actions/runs/5217528263/jobs/9417456918?pr=2773#step:11:270
Is there some "Write to |
Not quite sure what the underlying test looks like to say but if you don't want to verify the colored output then you can
|
|
btw in case someone brings up the entrenched strip-ansi-escapes, this is a benchmark from stripping the output from
|
Nice! Though for a library like insta — which has no UI and just wants to strip color codes — mitsuhiko/insta#378 — it is nice to have a very small dependency which only does the stripping. We can see what folks think there re the concept + the dependency size. (Or let me know if I'm thinking about this badly...) |
I expect strip-ansi-escapes to have worse build times Dependency trees:
|
Awesome! |
I'm trying to move PRQL over to
anstream
, in PRQL/prql#2773(This is based on rust-cli/concolor#47, and having coincidentally struggled to use a more global approach a few days ago in PRQL/prql#2755)
Is there an equivalent to
.ansi_color()
? For a dependency that doesn't itself useanstream
, I was intending to pass something down.Currently I'm doing this, but it doesn't cover the
Auto
case:https://github.com/PRQL/prql/pull/2773/files#diff-939acd3d8f24e19ce7ac0573190c87b1a63001bb386c20f7b36b3cf50e65a9edR290-R297
(You're of course welcome to critique the PR over there, but not expecting you to review every anstream PR...)
The text was updated successfully, but these errors were encountered: