Skip to content
This repository has been archived by the owner on Mar 10, 2021. It is now read-only.
/ term_size-rs Public archive

Functions for determining terminal sizes in Rust

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

clap-rs/term_size-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1fc68d3 · Sep 5, 2016

History

15 Commits
Sep 5, 2016
Jun 30, 2016
Jun 30, 2016
Sep 5, 2016
Sep 5, 2016
Sep 5, 2016
Jun 30, 2016
Jun 30, 2016
Jun 30, 2016
Jun 30, 2016
Jun 30, 2016
Jun 30, 2016

Repository files navigation

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.1"

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.