gecko-dev/third_party/rust/term_size
Servo VCS Sync be92d942e5 No bug - Revendor rust dependencies 2017-10-24 17:55:24 +00:00
..
src Bug 1341102 - Update vendored clap to get more consistent bitflags on a CLOSED TREE. 2017-06-01 09:52:00 +10:00
.cargo-checksum.json No bug - Revendor rust dependencies 2017-10-24 17:55:24 +00:00
.clog.toml
.travis.yml
CHANGELOG.md Bug 1341102 - Update vendored clap to get more consistent bitflags on a CLOSED TREE. 2017-06-01 09:52:00 +10:00
Cargo.toml Bug 1341102 - Update vendored clap to get more consistent bitflags on a CLOSED TREE. 2017-06-01 09:52:00 +10:00
LICENSE-APACHE
LICENSE-MIT
README.md Bug 1341102 - Update vendored clap to get more consistent bitflags on a CLOSED TREE. 2017-06-01 09:52:00 +10:00
appveyor.yml
index.html
justfile
rustfmt.toml Bug 1341102 - Update vendored clap to get more consistent bitflags on a CLOSED TREE. 2017-06-01 09:52:00 +10:00

README.md

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.