Skip to content

Commit 7304bc1

Browse files
committed
switch from atty to is-terminal
It's the more maintained crate and many do it now.
1 parent 6b9632e commit 7304bc1

File tree

4 files changed

+100
-32
lines changed

4 files changed

+100
-32
lines changed

Diff for: Cargo.lock

+89-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Cargo.toml

+5-5
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ fast = ["git-repository/max-performance"]
3333
## Use `clap` 3.0 to build the prettiest, best documented and most user-friendly CLI at the expense of binary size.
3434
## Provides a terminal user interface for detailed and exhaustive progress.
3535
## Provides a line renderer for leaner progress display, without the need for a full-blown TUI.
36-
pretty-cli = [ "gitoxide-core/serde1", "prodash/progress-tree", "prodash/progress-tree-log", "prodash/local-time", "env_logger/humantime", "env_logger/termcolor", "env_logger/atty" ]
36+
pretty-cli = [ "gitoxide-core/serde1", "prodash/progress-tree", "prodash/progress-tree-log", "prodash/local-time", "env_logger/humantime", "env_logger/color", "env_logger/auto-color" ]
3737

3838
## The `--verbose` flag will be powered by an interactive progress mechanism that doubles as log as well as interactive progress
3939
## that appears after a short duration.
40-
prodash-render-line-crossterm = ["prodash-render-line", "prodash/render-line-crossterm", "prodash/signal-hook", "atty", "crosstermion"]
40+
prodash-render-line-crossterm = ["prodash-render-line", "prodash/render-line-crossterm", "prodash/signal-hook", "is-terminal", "crosstermion"]
4141

4242
#! ### Convenience Features
4343
#! These combine common choices of the above features to represent typical builds
@@ -54,7 +54,7 @@ lean-async = ["fast", "pretty-cli", "gitoxide-core-tools", "gitoxide-core-async-
5454

5555
## As small as it can possibly be, no threading, no fast sha1, line progress only, rust based zlib implementation.
5656
## no networking, local operations only.
57-
small = ["pretty-cli", "git-features/rustsha1", "git-features/zlib-rust-backend", "prodash-render-line", "atty" ]
57+
small = ["pretty-cli", "git-features/rustsha1", "git-features/zlib-rust-backend", "prodash-render-line", "is-terminal" ]
5858

5959
## Makes the crate execute as fast as possible without pulling in C libraries, while keeping everything else minimal akin to the `small` build.
6060
max-pure = ["pretty-cli", "git-features/rustsha1", "git-features/zlib-rust-backend", "prodash-render-line", "prodash-render-tui", "git-repository/max-performance-safe", "http-client-reqwest", "gitoxide-core-blocking-client", "gitoxide-core-tools", "prodash/render-line-autoconfigure" ]
@@ -90,8 +90,8 @@ git-repository = { version = "^0.29.0", path = "git-repository", default-feature
9090

9191
clap = { version = "3.2.5", features = ["derive", "cargo"] }
9292
prodash = { version = "21.1", optional = true, default-features = false }
93-
atty = { version = "0.2.14", optional = true, default-features = false }
94-
env_logger = { version = "0.9.0", default-features = false }
93+
is-terminal = { version = "0.4.0", optional = true }
94+
env_logger = { version = "0.10.0", default-features = false }
9595
crosstermion = { version = "0.10.1", optional = true, default-features = false }
9696
futures-lite = { version = "1.12.0", optional = true, default-features = false, features = ["std"] }
9797

Diff for: git-repository/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ once_cell = "1.14.0"
121121
signal-hook = { version = "0.3.9", default-features = false }
122122
thiserror = "1.0.26"
123123
clru = "0.5.0"
124-
byte-unit = "4.0"
125124
log = "0.4.14"
126125
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]}
127126
smallvec = "1.9.0"

Diff for: src/plumbing/main.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -588,10 +588,11 @@ pub fn main() -> Result<()> {
588588
let input = if let Some(path) = pack_path {
589589
PathOrRead::Path(path)
590590
} else {
591-
if atty::is(atty::Stream::Stdin) {
591+
use is_terminal::IsTerminal;
592+
if std::io::stdin().is_terminal() {
592593
anyhow::bail!(
593-
"Refusing to read from standard input as no path is given, but it's a terminal."
594-
)
594+
"Refusing to read from standard input as no path is given, but it's a terminal."
595+
)
595596
}
596597
PathOrRead::Read(Box::new(stdin()))
597598
};
@@ -856,7 +857,8 @@ pub fn main() -> Result<()> {
856857
}
857858

858859
fn stdin_or_bail() -> Result<std::io::BufReader<std::io::Stdin>> {
859-
if atty::is(atty::Stream::Stdin) {
860+
use is_terminal::IsTerminal;
861+
if std::io::stdin().is_terminal() {
860862
anyhow::bail!("Refusing to read from standard input while a terminal is connected")
861863
}
862864
Ok(BufReader::new(stdin()))

0 commit comments

Comments
 (0)