Skip to content

Commit

Permalink
Replace atty with std is terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
AmrDeveloper committed Nov 4, 2024
1 parent d720c90 commit 53bf604
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
21 changes: 0 additions & 21 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ gitql-cli = "0.28.0"
gitql-ast = "0.25.0"
gitql-parser = "0.27.0"
gitql-engine = "0.28.0"
atty = "0.2.14"
clang-sys = "1.8.1"
7 changes: 4 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::io::IsTerminal;
use std::path::Path;

use crate::engine::EvaluationResult::SelectedGroups;
use arguments::Arguments;
use arguments::Command;
use atty::Stream;
use data_provider::ClangAstDataProvider;
use gitql_cli::arguments::OutputFormat;
use gitql_cli::diagnostic_reporter;
Expand Down Expand Up @@ -101,13 +101,14 @@ fn launch_clangql_repl(arguments: Arguments) {
let mut input = String::new();

loop {
let stdio = std::io::stdin();
// Render Prompt only if input is received from terminal
if atty::is(Stream::Stdin) {
if stdio.is_terminal() {
print!("clangql > ");
}

std::io::Write::flush(&mut std::io::stdout()).expect("flush failed!");
match std::io::stdin().read_line(&mut input) {
match stdio.read_line(&mut input) {
Ok(buffer_length) => {
if buffer_length == 0 {
break;
Expand Down

0 comments on commit 53bf604

Please sign in to comment.