Skip to content

Commit 75581e5

Browse files
authored
Merge pull request #1646 from tottoto/terminal-size
chore: replace term_size with terminal_size
2 parents fe5d98a + 9f16e96 commit 75581e5

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/volta-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ mock-network = ["mockito"]
1313
cross-platform-docs = []
1414

1515
[dependencies]
16-
term_size = "0.3.2"
16+
terminal_size = "0.3.0"
1717
indicatif = "0.17.7"
1818
console = ">=0.11.3, <1.0.0"
1919
readext = "0.1.0"

crates/volta-core/src/style.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use archive::Origin;
77
use cfg_if::cfg_if;
88
use console::{style, StyledObject};
99
use indicatif::{ProgressBar, ProgressStyle};
10+
use terminal_size::{terminal_size, Width};
1011

1112
pub const MAX_WIDTH: usize = 100;
1213
const MAX_PROGRESS_WIDTH: usize = 40;
@@ -49,7 +50,7 @@ where
4950

5051
/// Get the width of the terminal, limited to a maximum of MAX_WIDTH
5152
pub fn text_width() -> Option<usize> {
52-
term_size::dimensions().map(|(w, _)| w.min(MAX_WIDTH))
53+
terminal_size().map(|(Width(w), _)| (w as usize).min(MAX_WIDTH))
5354
}
5455

5556
/// Constructs a command-line progress bar based on the specified Origin enum

0 commit comments

Comments
 (0)