diff --git a/Cargo.lock b/Cargo.lock index d72ef20..ef1ede1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -318,6 +318,7 @@ dependencies = [ "libc", "once_cell", "terminal_size", + "unicode-width", "winapi", ] @@ -861,14 +862,13 @@ dependencies = [ [[package]] name = "indicatif" -version = "0.16.2" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d207dc617c7a380ab07ff572a6e52fa202a2a8f355860ac9c38e23f8196be1b" +checksum = "fcc42b206e70d86ec03285b123e65a5458c92027d1fb2ae3555878b8113b3ddf" dependencies = [ "console", - "lazy_static", "number_prefix", - "regex", + "unicode-width", ] [[package]] @@ -1898,6 +1898,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-width" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" + [[package]] name = "unicode-xid" version = "0.2.3" diff --git a/Cargo.toml b/Cargo.toml index ccf8b51..b610f7c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,7 @@ chrono = "0.4" crc32fast = "1.2" dirs = "4.0" hex = "0.4" -indicatif = "0.16" +indicatif = "0.17" pgp = "0.8" serde_json = "1.0" sha2 = "0.10" diff --git a/src/client/build.rs b/src/client/build.rs index 92651ea..e940e76 100644 --- a/src/client/build.rs +++ b/src/client/build.rs @@ -5,7 +5,7 @@ use serde::Deserialize; use url::Url; // Represents a single build of a HashiCorp product -#[derive(Clone, Debug, Deserialize, PartialEq)] +#[derive(Clone, Debug, Deserialize, Eq, PartialEq)] pub struct Build { pub arch: String, pub os: String, diff --git a/src/client/product_version.rs b/src/client/product_version.rs index 7f97744..84a7912 100644 --- a/src/client/product_version.rs +++ b/src/client/product_version.rs @@ -16,7 +16,7 @@ use super::build::Build; use url::Url; // Represents a single version of a HashiCorp product -#[derive(Clone, Debug, Deserialize, PartialEq)] +#[derive(Clone, Debug, Deserialize, Eq, PartialEq)] pub struct ProductVersion { pub builds: Vec, pub name: String, diff --git a/src/progressbar.rs b/src/progressbar.rs index b64dad1..439c76e 100644 --- a/src/progressbar.rs +++ b/src/progressbar.rs @@ -9,12 +9,12 @@ use indicatif::{ use std::io::Write; // How many times per second to redraw the progress bar. -const PROGRESS_UPDATE_HZ: u64 = 8; +const PROGRESS_UPDATE_HZ: u8 = 8; const PROGRESS_CHARS: &str = "#>-"; const PROGRESS_FINISHED_MSG: &str = "done."; const PROGRESS_TEMPLATE: &str = concat!( - "{spinner:green} ", + "{spinner:.green} ", "[{elapsed_precise}] ", "[{bar:40.cyan/blue}] ", "{bytes}/{total_bytes} ", @@ -70,7 +70,7 @@ impl ProgressBarBuilder { // new draw target. let target = ProgressDrawTarget::stderr_with_hz(PROGRESS_UPDATE_HZ); - let bar = if let Some(size) = self.size { + let bar = if self.size.is_some() { // If we know the total size, setup a nice bar let template = if self.no_color { PROGRESS_TEMPLATE_NO_COLOR @@ -81,9 +81,14 @@ impl ProgressBarBuilder { let style = ProgressStyle::default_bar() .template(template) + .unwrap() .progress_chars(PROGRESS_CHARS); - let pb = indicatif::ProgressBar::with_draw_target(size, target); + let pb = indicatif::ProgressBar::with_draw_target( + self.size, + target, + ); + pb.set_style(style); pb diff --git a/src/shasums.rs b/src/shasums.rs index 4badfec..4d90b11 100644 --- a/src/shasums.rs +++ b/src/shasums.rs @@ -13,7 +13,7 @@ use sha2::{ use std::collections::HashMap; use std::io; -#[derive(Debug, PartialEq)] +#[derive(Debug, Eq, PartialEq)] pub enum Checksum { OK, Bad,