diff options
author | Jesse Luehrs <doy@tozt.net> | 2023-02-18 18:18:16 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2023-02-18 18:18:16 -0500 |
commit | 71fd9206176ab8a22969dcfc01772851604f99e7 (patch) | |
tree | 17503927281d10e475e270dcd0a5507a29a971e4 | |
parent | 1fdbfb62ab7716cbc39a8575cd82b575beecf3bd (diff) | |
download | rbw-71fd9206176ab8a22969dcfc01772851604f99e7.tar.gz rbw-71fd9206176ab8a22969dcfc01772851604f99e7.zip |
replace term_size with terminal_size
-rw-r--r-- | Cargo.lock | 12 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/bin/rbw/main.rs | 6 |
3 files changed, 6 insertions, 14 deletions
@@ -1050,7 +1050,7 @@ dependencies = [ "sha1", "sha2", "tempfile", - "term_size", + "terminal_size", "textwrap", "thiserror", "tokio", @@ -1499,16 +1499,6 @@ dependencies = [ ] [[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" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -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()) } |