mirror of
https://github.com/nushell/nushell.git
synced 2025-08-18 01:39:46 +02:00
Use is-terminal
crate for now (#9670)
# Description Until we bump our minimal Rust version to `1.70.0` we can't use `std::io::IsTerminal`. The crate `is-terminal` (depending on `rustix` or `windows-sys`) can provide the same. Get's rid of the dependency on the outdated `atty` crate. We already transitively depend on it (e.g. through `miette`) As soon as we reach the new Rust version we can supersede this with @nibon7's #9550 Co-authored-by: nibon7 <nibon7@163.com>
This commit is contained in:
committed by
GitHub
parent
026335fff0
commit
39b43d1e4b
@@ -30,7 +30,6 @@ nu-utils = { path = "../nu-utils", version = "0.82.1" }
|
||||
|
||||
Inflector = "0.11"
|
||||
alphanumeric-sort = "1.5"
|
||||
atty = "0.2"
|
||||
base64 = "0.21"
|
||||
byteorder = "1.4"
|
||||
bytesize = "1.2"
|
||||
@@ -52,6 +51,7 @@ htmlescape = "0.3"
|
||||
indexmap = "2.0"
|
||||
indicatif = "0.17"
|
||||
is-root = "0.1"
|
||||
is-terminal = "0.4.8"
|
||||
itertools = "0.10"
|
||||
log = "0.4"
|
||||
lscolors = { version = "0.14", default-features = false, features = ["nu-ansi-term"] }
|
||||
@@ -124,7 +124,7 @@ nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.82.1" }
|
||||
nu-test-support = { path = "../nu-test-support", version = "0.82.1" }
|
||||
|
||||
dirs-next = "2.0"
|
||||
mockito = "1.1"
|
||||
mockito = { version = "1.1", default-features = false }
|
||||
quickcheck = "1.0"
|
||||
quickcheck_macros = "1.0"
|
||||
rstest = { version = "0.17", default-features = false }
|
||||
|
@@ -1,3 +1,4 @@
|
||||
use is_terminal::IsTerminal;
|
||||
use lscolors::{LsColors, Style};
|
||||
use nu_color_config::color_from_hex;
|
||||
use nu_color_config::{StyleComputer, TextStyle};
|
||||
@@ -848,8 +849,8 @@ enum TableView {
|
||||
|
||||
#[allow(clippy::manual_filter)]
|
||||
fn maybe_strip_color(output: String, config: &Config) -> String {
|
||||
// the atty is for when people do ls from vim, there should be no coloring there
|
||||
if !config.use_ansi_coloring || !atty::is(atty::Stream::Stdout) {
|
||||
// the terminal is for when people do ls from vim, there should be no coloring there
|
||||
if !config.use_ansi_coloring || !std::io::stdout().is_terminal() {
|
||||
// Draw the table without ansi colors
|
||||
nu_utils::strip_ansi_string_likely(output)
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user