diff options
author | Valentin Popov <valentin@popov.link> | 2024-07-19 15:37:58 +0300 |
---|---|---|
committer | Valentin Popov <valentin@popov.link> | 2024-07-19 15:37:58 +0300 |
commit | a990de90fe41456a23e58bd087d2f107d321f3a1 (patch) | |
tree | 15afc392522a9e85dc3332235e311b7d39352ea9 /vendor/supports-unicode/src/lib.rs | |
parent | 3d48cd3f81164bbfc1a755dc1d4a9a02f98c8ddd (diff) | |
download | fparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.tar.xz fparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.zip |
Deleted vendor folder
Diffstat (limited to 'vendor/supports-unicode/src/lib.rs')
-rw-r--r-- | vendor/supports-unicode/src/lib.rs | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/vendor/supports-unicode/src/lib.rs b/vendor/supports-unicode/src/lib.rs deleted file mode 100644 index b47b39b..0000000 --- a/vendor/supports-unicode/src/lib.rs +++ /dev/null @@ -1,42 +0,0 @@ -#![doc = include_str!("../README.md")] - -/// possible stream sources -#[derive(Clone, Copy, Debug)] -pub enum Stream { - Stdout, - Stderr, -} - -fn is_a_tty(stream: Stream) -> bool { - use is_terminal::*; - match stream { - Stream::Stdout => std::io::stdout().is_terminal(), - Stream::Stderr => std::io::stderr().is_terminal(), - } -} - -pub fn on(stream: Stream) -> bool { - if !is_a_tty(stream) { - // If we're just piping out, it's fine to spit out unicode! :) - true - } else if std::env::consts::OS == "windows" { - // Just a handful of things! - std::env::var("CI").is_ok() - || std::env::var("WT_SESSION").is_ok() // Windows Terminal - || std::env::var("ConEmuTask") == Ok("{cmd:Cmder}".into()) // ConEmu and cmder - || std::env::var("TERM_PROGRAM") == Ok("vscode".into()) - || std::env::var("TERM") == Ok("xterm-256color".into()) - || std::env::var("TERM") == Ok("alacritty".into()) - } else if std::env::var("TERM") == Ok("linux".into()) { - // Linux kernel console. Maybe redundant with the below?... - false - } else { - // From https://github.com/iarna/has-unicode/blob/master/index.js - let ctype = std::env::var("LC_ALL") - .or_else(|_| std::env::var("LC_CTYPE")) - .or_else(|_| std::env::var("LANG")) - .unwrap_or_else(|_| "".into()) - .to_uppercase(); - ctype.ends_with("UTF8") || ctype.ends_with("UTF-8") - } -} |