aboutsummaryrefslogtreecommitdiff
path: root/vendor/supports-hyperlinks/src
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2024-07-19 15:37:58 +0300
committerValentin Popov <valentin@popov.link>2024-07-19 15:37:58 +0300
commita990de90fe41456a23e58bd087d2f107d321f3a1 (patch)
tree15afc392522a9e85dc3332235e311b7d39352ea9 /vendor/supports-hyperlinks/src
parent3d48cd3f81164bbfc1a755dc1d4a9a02f98c8ddd (diff)
downloadfparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.tar.xz
fparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.zip
Deleted vendor folder
Diffstat (limited to 'vendor/supports-hyperlinks/src')
-rw-r--r--vendor/supports-hyperlinks/src/lib.rs67
1 files changed, 0 insertions, 67 deletions
diff --git a/vendor/supports-hyperlinks/src/lib.rs b/vendor/supports-hyperlinks/src/lib.rs
deleted file mode 100644
index 83290b2..0000000
--- a/vendor/supports-hyperlinks/src/lib.rs
+++ /dev/null
@@ -1,67 +0,0 @@
-#![doc = include_str!("../README.md")]
-
-/// possible stream sources
-#[derive(Clone, Copy, Debug)]
-pub enum Stream {
- Stdout,
- Stderr,
-}
-
-/// Returns true if the current terminal, detected through various environment
-/// variables, is known to support hyperlink rendering.
-pub fn supports_hyperlinks() -> bool {
- // Hyperlinks can be forced through this env var.
- if let Ok(arg) = std::env::var("FORCE_HYPERLINK") {
- return arg.trim() != "0";
- }
-
- if std::env::var("DOMTERM").is_ok() {
- // DomTerm
- return true;
- }
-
- if let Ok(version) = std::env::var("VTE_VERSION") {
- // VTE-based terminals above v0.50 (Gnome Terminal, Guake, ROXTerm, etc)
- if version.parse().unwrap_or(0) >= 5000 {
- return true;
- }
- }
-
- if let Ok(program) = std::env::var("TERM_PROGRAM") {
- if matches!(
- &program[..],
- "Hyper" | "iTerm.app" | "terminology" | "WezTerm" | "vscode"
- ) {
- return true;
- }
- }
-
- if let Ok(term) = std::env::var("TERM") {
- if matches!(&term[..], "xterm-kitty" | "alacritty" | "alacritty-direct") {
- return true;
- }
- }
-
- if let Ok(term) = std::env::var("COLORTERM") {
- if matches!(&term[..], "xfce4-terminal") {
- return true;
- }
- }
-
- // Windows Terminal and Konsole
- std::env::var("WT_SESSION").is_ok() || std::env::var("KONSOLE_VERSION").is_ok()
-}
-
-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(),
- }
-}
-
-/// Returns true if `stream` is a TTY, and the current terminal
-/// [supports_hyperlinks].
-pub fn on(stream: Stream) -> bool {
- (std::env::var("FORCE_HYPERLINK").is_ok() || is_a_tty(stream)) && supports_hyperlinks()
-}