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

19 lines
386 B
Rust
Raw Normal View History

2024-01-11 02:21:34 +00:00
use keyfork_crossterm::{
execute,
terminal::{size, SetSize},
tty::IsTty,
};
use std::io::{stdin, stdout};
pub 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");
}
}