• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

src/H03-May-2022-406191

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D02-May-202074 65

.gitignoreH A D02-May-2020216 2821

CHANGELOG.mdH A D02-May-20202.9 KiB7941

CONTRIBUTORS.mdH A D02-May-20201 KiB125

Cargo.tomlH A D02-May-20201.8 KiB7365

Cargo.toml.orig-cargoH A D02-May-20201.6 KiB6253

LICENSE-APACHEH A D02-May-202010.6 KiB202169

LICENSE-MITH A D02-May-20201.1 KiB2217

README.mdH A D02-May-20203.4 KiB7852

rustfmt.tomlH A D02-May-202098 54

README.md

1term_size
2====
3
4[![Crates.io](https://img.shields.io/crates/v/term_size.svg)](https://crates.io/crates/term_size) [![Crates.io](https://img.shields.io/crates/d/term_size.svg)](https://crates.io/crates/term_size) [![license](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/kbknapp/term_size-rs/blob/master/LICENSE-MIT) [![license](http://img.shields.io/badge/license-Apache2.0-blue.svg)](https://github.com/kbknapp/term_size-rs/blob/master/LICENSE-APACHE) [![Coverage Status](https://coveralls.io/repos/kbknapp/term_size-rs/badge.svg?branch=master&service=github)](https://coveralls.io/github/kbknapp/term_size-rs?branch=master) [![Join the chat at https://gitter.im/kbknapp/term_size-rs](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/kbknapp/term_size-rs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5
6Linux: [![Build Status](https://travis-ci.org/clap-rs/term_size-rs.svg?branch=master)](https://travis-ci.org/clap-rs/term_size-rs)
7Windows: [![Build status](https://ci.appveyor.com/api/projects/status/6q0x4h6i0e3ypbm5?svg=true
8)](https://ci.appveyor.com/project/kbknapp/term_size-rs/branch/master)
9
10A Rust library to enable getting terminal sizes and dimensions
11
12[Documentation](https://docs.rs/term_size)
13
14## Usage
15
16First, add the following to your `Cargo.toml`:
17
18```toml
19[dependencies]
20term_size = "1"
21```
22
23Next, add this to your crate root:
24
25```rust
26extern crate term_size;
27```
28
29To get the dimensions of your terminal window, simply use the following:
30
31```rust
32fn main() {
33  if let Some((w, h)) = term_size::dimensions() {
34    println!("Width: {}\nHeight: {}", w, h);
35  } else {
36    println!("Unable to get term size :(")
37  }
38}
39```
40
41## License
42
43Copyright Benjamin Sago, Kevin Knapp, and `term_size` contributors.
44
45Licensed under either of
46
47* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
48* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
49
50at your option. Unless you explicitly state otherwise, any contribution intentionally
51submitted for inclusion in the work by you, as defined in the
52Apache-2.0 license, shall be dual licensed as above, without any
53additional terms or conditions.
54
55## Contributing
56
571. Fork it!
582. Create your feature branch: `git checkout -b my-new-feature`
593. Commit your changes: `git commit -am 'Add some feature'`
604. Push to the branch: `git push origin my-new-feature`
615. Submit a pull request :D
62
63## Minimum Version of Rust
64
65`term_size` will officially support current stable Rust, minus two releases, but may work with prior releases as well. For example, current stable Rust at the time of this writing is 1.22.1, meaning `term_size` is guaranteed to compile with 1.20.0 and newer.
66
67At the 1.23.0 stable release, `term_size` will be guaranteed to compile with 1.21.0 and newer, etc.
68
69Upon bumping the minimum version of Rust (assuming it's within the stable-2 range), it must be clearly annotated in the [`CHANGELOG.md`](./CHANGELOG.md)
70
71## Breaking Changes
72
73`term_size` takes a similar policy to Rust and will bump the major version number upon breaking changes with only the following exceptions:
74
75* The breaking change is to fix a security concern
76* The breaking change is to be fixing a bug (i.e. relying on a bug as a feature)
77* The breaking change is a feature isn't used in the wild, or all users of said feature have given approval prior to the change
78