Was using atty when it's available in the stdlib.
This commit is contained in:
parent
03aa702c55
commit
8813605e5f
2 changed files with 2 additions and 4 deletions
|
@ -22,7 +22,6 @@ libc = "0.2.151"
|
||||||
ureq = { version = "2.8.0", features = ["json"] }
|
ureq = { version = "2.8.0", features = ["json"] }
|
||||||
serde_json = "1.0.108"
|
serde_json = "1.0.108"
|
||||||
argparse = "0.2.2"
|
argparse = "0.2.2"
|
||||||
atty = "0.2.14"
|
|
||||||
kradical_parsing = "0.1.0"
|
kradical_parsing = "0.1.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|
|
@ -3,7 +3,7 @@ mod kanji_search;
|
||||||
mod sentence_search;
|
mod sentence_search;
|
||||||
mod util;
|
mod util;
|
||||||
use std::{
|
use std::{
|
||||||
io::{stdin, stdout, Write},
|
io::{stdin, stdout, Write, IsTerminal},
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
process::{Command, Stdio},
|
process::{Command, Stdio},
|
||||||
env,
|
env,
|
||||||
|
@ -16,7 +16,6 @@ use sentence_search::sentence_search;
|
||||||
|
|
||||||
use argparse::{ArgumentParser, List, Print, Store, StoreTrue};
|
use argparse::{ArgumentParser, List, Print, Store, StoreTrue};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use atty::Stream;
|
|
||||||
use kradical_parsing::radk;
|
use kradical_parsing::radk;
|
||||||
|
|
||||||
macro_rules! JISHO_URL {
|
macro_rules! JISHO_URL {
|
||||||
|
@ -35,7 +34,7 @@ macro_rules! TATOEBA_URL_JPN_QUERY { () => {
|
||||||
|
|
||||||
fn main() -> Result<(), ureq::Error> {
|
fn main() -> Result<(), ureq::Error> {
|
||||||
|
|
||||||
let term_size = if atty::is(Stream::Stdout) {
|
let term_size = if stdout().is_terminal() {
|
||||||
terminal_size().unwrap_or(0)
|
terminal_size().unwrap_or(0)
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue