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

#34 in Command-line interface

Download history 3541/week @ 2024-08-21 3080/week @ 2024-08-28 4472/week @ 2024-09-04 3534/week @ 2024-09-11 4669/week @ 2024-09-18 5627/week @ 2024-09-25 6107/week @ 2024-10-02 6221/week @ 2024-10-09 5626/week @ 2024-10-16 9143/week @ 2024-10-23 7436/week @ 2024-10-30 6885/week @ 2024-11-06 5837/week @ 2024-11-13 9521/week @ 2024-11-20 9121/week @ 2024-11-27 7194/week @ 2024-12-04

33,312 downloads per month
Used in 79 crates (48 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

~215KB