minicrossterm/examples/is_tty.rs
2022-07-02 21:39:25 +02:00

19 lines
363 B
Rust

use crossterm::{
execute,
terminal::{size, SetSize},
tty::IsTty,
};
use std::io::{stdin, stdout};
pub fn main() {
println!("{:?}", size().unwrap());
execute!(stdout(), SetSize(10, 10)).unwrap();
println!("{:?}", size().unwrap());
if stdin().is_tty() {
println!("Is TTY");
} else {
println!("Is not TTY");
}
}