diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-02-16 10:10:07 +0100 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-02-16 10:10:07 +0100 |
commit | 9da970f1f44f19432680e255f91f73fbb8fbe3c8 (patch) | |
tree | 7bf2e5ded6d81b4ae76a080eaa5f80418343a5a9 /crates/termsize/README.md | |
parent | refactor(treewide): Remove all references of the now obsolete update_raw.py (diff) | |
download | yt-9da970f1f44f19432680e255f91f73fbb8fbe3c8.zip |
chore(crates/termsize): Vendor
Diffstat (limited to 'crates/termsize/README.md')
-rw-r--r-- | crates/termsize/README.md | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/crates/termsize/README.md b/crates/termsize/README.md new file mode 100644 index 0000000..27b7869 --- /dev/null +++ b/crates/termsize/README.md @@ -0,0 +1,49 @@ +<!-- +yt - A fully featured command line YouTube client + +Copyright (C) 2025 softprops <d.tangren@gmail.com> +SPDX-License-Identifier: MIT + +This file is part of Yt. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +--> + +# termsize + +[](https://github.com/softprops/termsize/actions/workflows/ci.yml) +[](https://crates.io/crates/termsize) + +> because terminal size matters + +Termsize is a rust crate providing a multi-platform interface for resolving +your terminal's current size in rows and columns. On most unix systems, this is similar invoking the [stty(1)](http://man7.org/linux/man-pages/man1/stty.1.html) program, requesting the terminal size. + + +## [Documentation](https://softprops.github.com/termsize) + +## install + +run `cargo add termsize` in your terminal or add the following to your `Cargo.toml` file + +```toml +[dependencies] +termsize = "0.1" +``` + +## usage + +Termize provides one function, `get`, which returns a `termsize::Size` struct +exposing two fields: `rows` and `cols` representing the number of rows and columns +a a terminal's stdout supports. + +```rust +pub fn main() { + termsize::get().map(|{ rows, cols }| { + println!("rows {} cols {}", size.rows, size.cols) + }); +} +``` + +Doug Tangren (softprops) 2015-2024 \ No newline at end of file |