-
Notifications
You must be signed in to change notification settings - Fork 19
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
Reduce verbosity in getting the final color for a stream #91
Comments
In my applications, I did this with just a let colored_stderr = !matches!(
anstream::AutoStream::choice(&std::io::stderr()),
anstream::ColorChoice::Never
); (this was passed to |
We also had Whatever you did, I see everyone needing to do it. That means, we need to simplify the verbosity of it. |
Even simplifying the And then we can add |
First,
That is the natural choice but I ended up not going with it in #75 which I unfortunately did not document. I think its two parts
|
I have seen you mention this more than once, but I am still quite confused about what you mean. Can you please give more details? What about the |
A naive implementation of asking an match self {
StreamInner::PassThrough(_) => AlwaysAnsi,
StreamInner::Strip(_) => Never,
#[cfg(all(windows, feature = "wincon"))]
StreamInner::Wincon(_) => Never,
} which returns a different result than If we wanted to have the same behavior of |
Yup, when I was proposing the change to the API, I assumed the implementation would change to this too. I should have clarified it more. What are the objections for this new implementation? |
I remember it was a very conscious choice but I do not remember what all went into it. My focus is currently elsewhere for the current time so I'll just leave it at that rather than distract myself with having to come back up to speed on it. |
I will try to make a PR then and see if anything pops up. |
With the updated crates and API:
Before, it used to be:
I think we can make it simpler similarly:
All we have to do is add
pub fn color(&self) -> bool
toanstream::AutoStream
The text was updated successfully, but these errors were encountered: