colored-rs / colored

(Rust) Coloring terminal so simple you already know how to do it !

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use is_terminal from std lib?

jcamiel opened this issue · comments

Hi,
In Rust 1.70, is_terminal is available on std::io::stdout()/stderr()/stdin(), maybe this is an opportunity to remove the atty dependency?

In /colored/src/control.rs instead of:

ShouldColorize {
            clicolor: ShouldColorize::normalize_env(env::var("CLICOLOR")).unwrap_or(true)
                && atty::is(atty::Stream::Stdout),

The code can be now:

ShouldColorize {
            clicolor: ShouldColorize::normalize_env(env::var("CLICOLOR")).unwrap_or(true)
                && std::io::stdout().is_terminal(),

I can make a PR if needed!

Thanks,

Ah sorry, I didn't check PR (#134), fill free to close mine!

This is actually being discussed in #122 (comment) as well, an MSRV just needs to be decided on before figuring out if a crate or the stdlib will be used.

Feel free to track the issue linked in that PR for any updates :)