rustc/vendor/term_size
2019-11-27 12:13:46 +00:00
..
src New upstream version 1.39.0+dfsg1 2019-11-27 12:13:46 +00:00
.cargo-checksum.json New upstream version 1.39.0+dfsg1 2019-11-27 12:13:46 +00:00
appveyor.yml New upstream version 1.39.0+dfsg1 2019-11-27 12:13:46 +00:00
Cargo.toml New upstream version 1.39.0+dfsg1 2019-11-27 12:13:46 +00:00
CHANGELOG.md New upstream version 1.39.0+dfsg1 2019-11-27 12:13:46 +00:00
CONTRIBUTORS.md New upstream version 1.39.0+dfsg1 2019-11-27 12:13:46 +00:00
index.html New upstream version 1.39.0+dfsg1 2019-11-27 12:13:46 +00:00
justfile New upstream version 1.39.0+dfsg1 2019-11-27 12:13:46 +00:00
LICENSE-APACHE New upstream version 1.39.0+dfsg1 2019-11-27 12:13:46 +00:00
LICENSE-MIT New upstream version 1.39.0+dfsg1 2019-11-27 12:13:46 +00:00
README.md New upstream version 1.39.0+dfsg1 2019-11-27 12:13:46 +00:00
rustfmt.toml New upstream version 1.39.0+dfsg1 2019-11-27 12:13:46 +00:00

term_size

Crates.io Crates.io license license Coverage Status Join the chat at https://gitter.im/kbknapp/term_size-rs

Linux: Build Status Windows: Build status

A Rust library to enable getting terminal sizes and dimensions

Documentation

Usage

First, add the following to your Cargo.toml:

[dependencies]
term_size = "0.3"

Next, add this to your crate root:

extern crate term_size;

To get the dimensions of your terminal window, simply use the following:

fn main() {
  if let Some((w, h)) = term_size::dimensions() {
    println!("Width: {}\nHeight: {}", w, h);
  } else {
    println!("Unable to get term size :(")
  }
}

License

Copyright Benjamin Sago, Kevin Knapp, and term_size contributors.

Licensed under either of

at your option.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.