10 releases

new 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

#39 in Command-line interface

Download history 3535/week @ 2024-04-05 3646/week @ 2024-04-12 2464/week @ 2024-04-19 2825/week @ 2024-04-26 1431/week @ 2024-05-03 1495/week @ 2024-05-10 2479/week @ 2024-05-17 1975/week @ 2024-05-24 1501/week @ 2024-05-31 2709/week @ 2024-06-07 4091/week @ 2024-06-14 2113/week @ 2024-06-21 2937/week @ 2024-06-28 3390/week @ 2024-07-05 5135/week @ 2024-07-12 3442/week @ 2024-07-19

15,383 downloads per month
Used in 56 crates (33 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