forked from extern/nushell
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
@ -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