Skip to content

Commit

Permalink
refactor: remove atty dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
StoneDot authored and ryota-sakamoto committed Mar 22, 2024
1 parent 9eb1e29 commit 5c682e5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
1 change: 0 additions & 1 deletion 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 @@ -30,7 +30,6 @@ name = "dy"
path = "src/main.rs"

[dependencies]
atty = "0.2"
chrono = "0.4"
dialoguer = "0.10.4"
dirs = "4.0.0"
Expand Down
4 changes: 2 additions & 2 deletions src/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

use crate::cmd;
use log::debug;
use std::io::{stdout, BufRead, Stdin, StdinLock, Write};
use std::io::{stdout, BufRead, IsTerminal, Stdin, StdinLock, Write};
use std::{error::Error, io};

/* =================================================
Expand Down Expand Up @@ -52,7 +52,7 @@ impl<'a> ShellReader<'a> {
}

pub fn read_line(&mut self) -> Result<ShellInput, Box<dyn Error>> {
if atty::is(atty::Stream::Stdin) {
if io::stdin().is_terminal() {
print!("> ");
stdout().flush().expect("failed to flush output");
}
Expand Down

0 comments on commit 5c682e5

Please sign in to comment.