termsize

Crates.iotermsize
lib.rstermsize
version0.1.6
sourcesrc
created_at2015-11-15 05:54:18.407317
updated_at2019-04-28 16:49:21.143093
descriptionRetrieves terminal size
homepagehttps://github.com/softprops/termsize
repositoryhttps://github.com/softprops/termsize
max_upload_size
id3425
size12,777
cargo (github:rustpq:cargo)

documentation

http://softprops.github.io/termsize

README

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

Commit count: 94

cargo fmt