From 71fd9206176ab8a22969dcfc01772851604f99e7 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 18 Feb 2023 18:18:16 -0500 Subject: replace term_size with terminal_size --- Cargo.lock | 12 +----------- Cargo.toml | 2 +- src/bin/rbw/main.rs | 6 ++++-- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1a311b0..a40ac8f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1050,7 +1050,7 @@ dependencies = [ "sha1", "sha2", "tempfile", - "term_size", + "terminal_size", "textwrap", "thiserror", "tokio", @@ -1498,16 +1498,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "term_size" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "termcolor" version = "1.2.0" diff --git a/Cargo.toml b/Cargo.toml index 8f6bd27..cfe1a33 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,7 @@ serde_repr = "0.1.10" sha1 = "0.10.5" sha2 = "0.10.6" tempfile = "3.3.0" -term_size = "0.3.2" +terminal_size = "0.2.5" textwrap = "0.16.0" thiserror = "1.0.38" tokio = { version = "1.25.0", features = ["full"] } diff --git a/src/bin/rbw/main.rs b/src/bin/rbw/main.rs index 97784b7..cdfcc39 100644 --- a/src/bin/rbw/main.rs +++ b/src/bin/rbw/main.rs @@ -288,9 +288,11 @@ fn main() { env_logger::Env::default().default_filter_or("info"), ) .format(|buf, record| { - if let Some((w, _)) = term_size::dimensions() { + if let Some((terminal_size::Width(w), _)) = + terminal_size::terminal_size() + { let out = format!("{}: {}", record.level(), record.args()); - writeln!(buf, "{}", textwrap::fill(&out, w - 1)) + writeln!(buf, "{}", textwrap::fill(&out, usize::from(w) - 1)) } else { writeln!(buf, "{}: {}", record.level(), record.args()) } -- cgit v1.2.3-54-g00ecf