Renaming NO_COLOR_IS_SET to DISABLE_COLORED_TEXT

This commit is contained in:
João M. Bezerra 2021-10-15 09:35:07 -03:00
parent 161b8d0d66
commit 15c54a615d

View File

@ -67,14 +67,14 @@ pub struct Bytes {
pub mod colors { pub mod colors {
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
static NO_COLOR_IS_SET: Lazy<bool> = Lazy::new(|| { static DISABLE_COLORED_TEXT: Lazy<bool> = Lazy::new(|| {
std::env::var_os("NO_COLOR").is_some() || atty::isnt(atty::Stream::Stdout) || atty::isnt(atty::Stream::Stderr) std::env::var_os("NO_COLOR").is_some() || atty::isnt(atty::Stream::Stdout) || atty::isnt(atty::Stream::Stderr)
}); });
macro_rules! color { macro_rules! color {
($name:ident = $value:literal) => { ($name:ident = $value:literal) => {
#[cfg(target_family = "unix")] #[cfg(target_family = "unix")]
pub static $name: Lazy<&str> = Lazy::new(|| if *NO_COLOR_IS_SET { "" } else { $value }); pub static $name: Lazy<&str> = Lazy::new(|| if *DISABLE_COLORED_TEXT { "" } else { $value });
#[cfg(not(target_family = "unix"))] #[cfg(not(target_family = "unix"))]
pub static $name: &&str = &""; pub static $name: &&str = &"";
}; };