gecko-dev/third_party/rust/term_size
Kartikaya Gupta 47c3dd535d Bug 1369156 - Re-vendor third-party rust libraries with latest cargo-vendor. r=froydnj
MozReview-Commit-ID: LQicTh0fmk0

--HG--
extra : rebase_source : 7a5ee9c3242fefa72e8d0372b8e9c03170c7df4b
2017-06-20 16:05:17 -04: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 Bug 1369156 - Re-vendor third-party rust libraries with latest cargo-vendor. r=froydnj 2017-06-20 16:05:17 -04:00
.cargo-ok
.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.