summaryrefslogtreecommitdiffstats
path: root/sq
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 /sq
parenta9ac52a46fa38d60664ddd8f2d046803ba111a33 (diff)
sq: Use term_size to get the terminal's width.
- term_size is packaged in Debian.
Diffstat (limited to 'sq')
-rw-r--r--sq/Cargo.toml2
-rw-r--r--sq/src/commands/decrypt.rs3
-rw-r--r--sq/src/sq.rs5
3 files changed, 3 insertions, 7 deletions
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)?;