10 releases

0.1.9 Jul 22, 2024
0.1.8 Jun 16, 2024
0.1.6 Apr 28, 2019
0.1.5 Oct 1, 2017
0.1.0 Nov 15, 2015

#31 in Command-line interface

Download history 4454/week @ 2024-07-20 4665/week @ 2024-07-27 3299/week @ 2024-08-03 4166/week @ 2024-08-10 3291/week @ 2024-08-17 3197/week @ 2024-08-24 4568/week @ 2024-08-31 3361/week @ 2024-09-07 3723/week @ 2024-09-14 5515/week @ 2024-09-21 5808/week @ 2024-09-28 6171/week @ 2024-10-05 6304/week @ 2024-10-12 7183/week @ 2024-10-19 8789/week @ 2024-10-26 6680/week @ 2024-11-02

29,703 downloads per month
Used in 69 crates (44 directly)

MIT license

8KB
143 lines

termsize

CI Crates.io

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.

Documentation

install

run cargo add termsize in your terminal or add the following to your Cargo.toml file

[dependencies]
termsize = "0.1"

usage

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.

pub fn main() {
  termsize::get().map(|{ rows, cols }| {
    println!("rows {} cols {}", size.rows, size.cols)
  });
}

Doug Tangren (softprops) 2015-2024

Dependencies

~220KB