mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-07 12:05:46 +00:00
Renaming NO_COLOR_IS_SET to DISABLE_COLORED_TEXT
This commit is contained in:
parent
161b8d0d66
commit
15c54a615d
@ -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 = &"";
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user