2 releases

0.2.1 Aug 13, 2023
0.2.0 Apr 4, 2023

#624 in Command-line interface

Download history 11/week @ 2024-02-23 6/week @ 2024-03-01 2/week @ 2024-03-08 3/week @ 2024-03-15 2/week @ 2024-03-22 28/week @ 2024-03-29 92/week @ 2024-04-05 6/week @ 2024-04-12

129 downloads per month
Used in markdown-formatter

MIT license

8KB
137 lines

termsize

Build Status Build status Coverage Status

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

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.

extern crate termsize;

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

Doug Tangren (softprops) 2015-2017

Dependencies

~230KB