Skip to content

Commit

Permalink
Update indicatif to 0.17
Browse files Browse the repository at this point in the history
  • Loading branch information
phyber committed Aug 16, 2022
1 parent c595cf9 commit 4088ca4
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 12 deletions.
14 changes: 10 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/client/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/client/product_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Build>,
pub name: String,
Expand Down
13 changes: 9 additions & 4 deletions src/progressbar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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} ",
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/shasums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 4088ca4

Please sign in to comment.