Crates.io | termsize-alt |
lib.rs | termsize-alt |
version | 0.2.1 |
source | src |
created_at | 2023-04-04 16:15:17.654005 |
updated_at | 2023-08-13 22:05:09.986822 |
description | Retrieves terminal size |
homepage | https://github.com/softprops/termsize |
repository | https://github.com/zhongdongy/termsize-alt |
max_upload_size | |
id | 830317 |
size | 13,645 |
because terminal size matters
Termsize is a rust crate providing a multi-platform interface for resolving your terminal's current size in rows and columns. On most unix systems, this is similar invoking the stty(1) program, requesting the terminal size.
add the following to your Cargo.toml
file
[dependencies]
termsize = "0.1"
Termize provides one function, get
, which returns a termsize::Size
struct
exposing two fields: rows
and cols
representing the number of rows and columns
a a terminal's stdout supports.
extern crate termsize;
pub fn main() {
termsize::get().map(|size| {
println!("rows {} cols {}", size.rows, size.cols)
});
}
Doug Tangren (softprops) 2015-2017