Skip to content

Commit a467180

Browse files
committed
Replace atty with std is_terminal
1 parent 001113e commit a467180

File tree

3 files changed

+7
-26
lines changed

3 files changed

+7
-26
lines changed

Cargo.lock

Lines changed: 0 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ gitql-cli = "0.28.0"
1919
gitql-ast = "0.25.0"
2020
gitql-parser = "0.27.0"
2121
gitql-engine = "0.28.0"
22-
atty = "0.2.14"

src/main.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
use std::io;
2+
use std::io::IsTerminal;
13
use std::path::Path;
24

35
use crate::engine::EvaluationResult::SelectedGroups;
46
use arguments::Arguments;
57
use arguments::Command;
6-
use atty::Stream;
78
use data_provider::FileDataProvider;
89
use gitql_cli::arguments::OutputFormat;
910
use gitql_cli::diagnostic_reporter;
@@ -98,13 +99,15 @@ fn launch_fileql_repl(arguments: Arguments) {
9899
let mut input = String::new();
99100

100101
loop {
102+
let stdio = io::stdin();
103+
101104
// Render Prompt only if input is received from terminal
102-
if atty::is(Stream::Stdin) {
103-
print!("fql > ");
105+
if stdio.is_terminal() {
106+
print!("fileql > ");
104107
}
105108

106109
std::io::Write::flush(&mut std::io::stdout()).expect("flush failed!");
107-
match std::io::stdin().read_line(&mut input) {
110+
match stdio.read_line(&mut input) {
108111
Ok(buffer_length) => {
109112
if buffer_length == 0 {
110113
break;

0 commit comments

Comments
 (0)