Skip to content

Commit

Permalink
chore: remove atty (#587)
Browse files Browse the repository at this point in the history
Co-authored-by: LoricAndre <loric.andre@pm.me>
  • Loading branch information
LoricAndre and LoricAndre authored Nov 18, 2024
1 parent 8222a3f commit 838ba21
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 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.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ path = "src/bin/main.rs"

[dependencies]
nix = "0.29.0"
atty = { version = "0.2.14", optional = true }
regex = "1.11.1"
lazy_static = "1.5.0"
shlex = { version = "1.3.0", optional = true }
Expand All @@ -41,7 +40,7 @@ defer-drop = "1.3.0"

[features]
default = ["cli"]
cli = ["dep:clap", "dep:atty", "dep:shlex", "dep:env_logger"]
cli = ["dep:clap", "dep:shlex", "dep:env_logger"]

[profile.release]
lto = true
Expand Down
13 changes: 6 additions & 7 deletions src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ extern crate clap;
extern crate env_logger;
#[macro_use]
extern crate log;
extern crate atty;
extern crate shlex;
extern crate skim;

use derive_builder::Builder;
use std::env;
use std::fs::File;
use std::io::{BufRead, BufReader, BufWriter, Write};
use std::io::{BufRead, BufReader, BufWriter, IsTerminal, Write};

use clap::{crate_version, App, Arg, ArgMatches};
use skim::prelude::*;
Expand Down Expand Up @@ -314,11 +313,11 @@ fn real_main() -> Result<i32, std::io::Error> {

//------------------------------------------------------------------------------
// read from pipe or command
let rx_item = if atty::isnt(atty::Stream::Stdin) {
let rx_item = cmd_collector.borrow().of_bufread(BufReader::new(std::io::stdin()));
Some(rx_item)
} else {
None
let rx_item = if ! std::io::stdin().is_terminal() {
let rx_item = cmd_collector.borrow().of_bufread(BufReader::new(std::io::stdin()));
Some(rx_item)
} else {
None
};

//------------------------------------------------------------------------------
Expand Down

0 comments on commit 838ba21

Please sign in to comment.