Compare commits

...

2 Commits

Author SHA1 Message Date
andy.boot
8553d95f6d Increment version
new flags added -e -v -t
2021-09-19 11:17:33 +01:00
andy.boot
21d3f2bc7e bugfix: Allow dust to work on low width terminal
Do not assume the min width is 80 (unless on windows).
2021-09-19 11:17:33 +01:00
3 changed files with 12 additions and 2 deletions

2
Cargo.lock generated
View File

@@ -157,7 +157,7 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
[[package]]
name = "du-dust"
version = "0.6.2"
version = "0.7.0"
dependencies = [
"ansi_term 0.12.1",
"assert_cmd",

View File

@@ -1,7 +1,7 @@
[package]
name = "du-dust"
description = "A more intuitive version of du"
version = "0.6.2"
version = "0.7.0"
authors = ["bootandy <bootandy@gmail.com>", "nebkor <code@ardent.nebcorp.com>"]
edition = "2018"
readme = "README.md"

View File

@@ -64,6 +64,7 @@ fn get_height_of_terminal() -> usize {
}
}
#[cfg(windows)]
fn get_width_of_terminal() -> usize {
// Windows CI runners detect a very low terminal width
if let Some((Width(w), Height(_h))) = terminal_size() {
@@ -73,6 +74,15 @@ fn get_width_of_terminal() -> usize {
}
}
#[cfg(not(windows))]
fn get_width_of_terminal() -> usize {
if let Some((Width(w), Height(_h))) = terminal_size() {
w as usize
} else {
DEFAULT_TERMINAL_WIDTH
}
}
fn get_regex_value(maybe_value: Option<&str>) -> Option<Regex> {
match maybe_value {
Some(v) => match Regex::new(v) {