summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2021-01-15 11:06:48 +0100
committerJustus Winter <justus@sequoia-pgp.org>2021-01-15 11:34:49 +0100
commitcf2396f57b61052fbc51a030b846e0e98f35a586 (patch)
tree9315ccfea80399b9279b2080ee259d17fbc9c27c
parenta9ac52a46fa38d60664ddd8f2d046803ba111a33 (diff)
sq: Use term_size to get the terminal's width.
- term_size is packaged in Debian.
-rw-r--r--Cargo.lock34
-rw-r--r--sq/Cargo.toml2
-rw-r--r--sq/src/commands/decrypt.rs3
-rw-r--r--sq/src/sq.rs5
4 files changed, 14 insertions, 30 deletions
diff --git a/Cargo.lock b/Cargo.lock
index fdbd184f..ee782858 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -455,28 +455,6 @@ dependencies = [
]
[[package]]
-name = "crossterm"
-version = "0.13.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "759f2256ab248ad498bdd62038187450921b1b8d24c348d198f3425b0bd289cb"
-dependencies = [
- "crossterm_winapi",
- "lazy_static",
- "libc",
- "mio",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "crossterm_winapi"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "02de3a35bcabb5bb6dc7d4449abb546d23f123b06f074e2cf1c50db516da6ac8"
-dependencies = [
- "winapi 0.3.9",
-]
-
-[[package]]
name = "crypto-mac"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1995,7 +1973,6 @@ dependencies = [
"buffered-reader",
"chrono",
"clap",
- "crossterm",
"itertools",
"predicates",
"rpassword",
@@ -2004,6 +1981,7 @@ dependencies = [
"sequoia-net",
"sequoia-openpgp",
"tempfile",
+ "term_size",
"tokio",
]
@@ -2242,6 +2220,16 @@ dependencies = [
]
[[package]]
+name = "term_size"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9"
+dependencies = [
+ "libc",
+ "winapi 0.3.9",
+]
+
+[[package]]
name = "textwrap"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/sq/Cargo.toml b/sq/Cargo.toml
index a32c32b6..cf91402e 100644
--- a/sq/Cargo.toml
+++ b/sq/Cargo.toml
@@ -32,7 +32,7 @@ chrono = "0.4.10"
clap = "2.33"
itertools = "0.9"
tempfile = "3.1"
-crossterm = "0.13"
+term_size = "0.3"
tokio = { version = "0.2.19", features = ["rt-core", "io-util", "io-driver"] }
rpassword = "5.0"
diff --git a/sq/src/commands/decrypt.rs b/sq/src/commands/decrypt.rs
index 31d4ab33..3f196a57 100644
--- a/sq/src/commands/decrypt.rs
+++ b/sq/src/commands/decrypt.rs
@@ -1,4 +1,3 @@
-use crossterm::terminal;
use anyhow::Context as _;
use std::collections::HashMap;
use std::io;
@@ -77,7 +76,7 @@ impl Helper {
key_hints: hints,
dump_session_key: dump_session_key,
dumper: if dump {
- let width = terminal::size().ok().map(|(cols, _)| cols as usize)
+ let width = term_size::dimensions_stdout().map(|(w, _)| w)
.unwrap_or(80);
Some(PacketDumper::new(width, false))
} else {
diff --git a/sq/src/sq.rs b/sq/src/sq.rs
index f9777c2c..eef1e6dc 100644
--- a/sq/src/sq.rs
+++ b/sq/src/sq.rs
@@ -1,8 +1,5 @@
/// A command-line frontend for Sequoia.
-use crossterm;
-
-use crossterm::terminal;
use anyhow::Context as _;
use std::fs::OpenOptions;
use std::io::{self, Write};
@@ -447,7 +444,7 @@ fn main() -> Result<()> {
} else {
None
};
- let width = terminal::size().ok().map(|(cols, _)| cols as usize);
+ let width = term_size::dimensions_stdout().map(|(w, _)| w);
commands::dump(&mut input, &mut output,
m.is_present("mpis"), m.is_present("hex"),
session_key.as_ref(), width)?;