Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Replace atty with is-terminal #4430

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 6 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions prqlc/prqlc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ metadata.msrv = "1.70.0"
[features]
cli = [
"anyhow",
"atty",
"is-terminal",
"clap_complete_command",
"clap_complete",
"clap",
Expand All @@ -33,8 +33,8 @@ test-dbs = ["anyhow", "duckdb", "glob", "rusqlite", "tokio"]
test-dbs-external = ["anyhow", "duckdb", "glob", "mysql", "pg_bigdecimal", "postgres", "rusqlite", "tiberius", "tokio", "tokio-util"]

[dependencies]
prqlc-ast = {path = "../prqlc-ast", version = "0.11.5" }
prqlc-parser = {path = "../prqlc-parser", version = "0.11.5" }
prqlc-ast = {path = "../prqlc-ast", version = "0.11.5"}
prqlc-parser = {path = "../prqlc-parser", version = "0.11.5"}

anstream = {version = "0.6.13", features = ["auto"]}
ariadne = "0.4.0"
Expand All @@ -60,13 +60,13 @@ strum_macros = "0.26.2"
# unique dependencies from the CLI, marked as optional and included in the 'cli'
# feature
anyhow = {version = "1.0.82", features = ["backtrace"], optional = true}
atty = {version = "0.2.14", optional = true}
clap = {version = "4.4.18", features = ["derive", "env", "wrap_help"], optional = true}
clap_complete_command = {version = "0.5.1", optional = true}
clio = {version = "0.3.3", features = ['clap-parse'], optional = true}
color-eyre = {version = "0.6.3", optional = true}
colorchoice-clap = {version = "1.0.0", optional = true}
env_logger = {version = "0.10.2", features = ["color"], optional = true}
is-terminal = {version = "0.4.12", optional = true}
notify = {version = "6.1.1", optional = true}
walkdir = {version = "2.5.0", optional = true}

Expand Down
4 changes: 2 additions & 2 deletions prqlc/prqlc/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use ariadne::Source;
use clap::{CommandFactory, Parser, Subcommand, ValueHint};
use clio::has_extension;
use clio::Output;
use is_terminal::IsTerminal;
use itertools::Itertools;
use std::collections::HashMap;
use std::env;
Expand Down Expand Up @@ -464,8 +465,7 @@ impl Command {
//
// See https://github.com/PRQL/prql/issues/3228 for details on us not
// yet using `input.is_tty()`.
// if input.is_tty() {
if input.path() == Path::new("-") && atty::is(atty::Stream::Stdin) {
if input.path() == Path::new("-") && std::io::stdin().is_terminal() {
#[cfg(unix)]
eprintln!("Enter PRQL, then press ctrl-d to compile:\n");
#[cfg(windows)]
Expand Down
Loading