keyfork/crates/util/keyfork-crossterm/examples/is_tty.rs

21 lines
407 B
Rust

#![allow(missing_docs)]
use keyfork_crossterm::{
execute,
terminal::{size, SetSize},
tty::IsTty,
};
use std::io::{stdin, stdout};
fn main() {
println!("size: {:?}", size().unwrap());
execute!(stdout(), SetSize(10, 10)).unwrap();
println!("resized: {:?}", size().unwrap());
if stdin().is_tty() {
println!("Is TTY");
} else {
println!("Is not TTY");
}
}