| 1 |
terminal-size |
| 2 |
============= |
| 3 |
|
| 4 |
|
| 5 |
[Documentation](https://docs.rs/terminal_size) |
| 6 |
|
| 7 |
|
| 8 |
Rust library for getting the size of your terminal. |
| 9 |
|
| 10 |
Works on Linux, macOS, Windows, and illumos. |
| 11 |
|
| 12 |
```rust |
| 13 |
use terminal_size::{Width, Height, terminal_size}; |
| 14 |
|
| 15 |
let size = terminal_size(); |
| 16 |
if let Some((Width(w), Height(h))) = size { |
| 17 |
println!("Your terminal is {} cols wide and {} lines tall", w, h); |
| 18 |
} else { |
| 19 |
println!("Unable to get terminal size"); |
| 20 |
} |
| 21 |
``` |
| 22 |
|
| 23 |
## Minimum Rust Version |
| 24 |
|
| 25 |
This crate requires a minimum Rust version of 1.71.0 (2023-07-13). |
| 26 |
|
| 27 |
## License |
| 28 |
|
| 29 |
Licensed under either of |
| 30 |
|
| 31 |
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or https://www.apache.org/licenses/LICENSE-2.0) |
| 32 |
* MIT license ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT) |
| 33 |
|
| 34 |
at your option. |
| 35 |
|
| 36 |
### Contribution |
| 37 |
|
| 38 |
Unless you explicitly state otherwise, any contribution intentionally |
| 39 |
submitted for inclusion in the work by you, as defined in the Apache-2.0 |
| 40 |
license, shall be dual licensed as above, without any additional terms or |
| 41 |
conditions. |