Skip to content

Commit

Permalink
Temporarily remove indicatif dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
fitzgen committed Sep 7, 2018
1 parent d0fc382 commit afc9a5c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 33 deletions.
19 changes: 11 additions & 8 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 @@ -14,7 +14,7 @@ curl = "0.4.13"
failure = "0.1.2"
flate2 = "1.0.2"
human-panic = "1.0.1"
indicatif = "0.9.0"
humantime = "1.1.1"
lazy_static = "1.1.0"
openssl = { version = '0.10.11', optional = true }
parking_lot = "0.6"
Expand Down
4 changes: 2 additions & 2 deletions src/command/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use build;
use command::utils::{create_pkg_dir, set_crate_path};
use emoji;
use error::Error;
use indicatif::HumanDuration;
use humantime::format_duration;
use manifest;
use progressbar::Step;
use readme;
Expand Down Expand Up @@ -108,7 +108,7 @@ impl Build {
step_counter.inc();
}

let duration = HumanDuration(started.elapsed());
let duration = format_duration(started.elapsed());
info!(&log, "Done in {}.", &duration);
info!(
&log,
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ extern crate curl;
#[macro_use]
extern crate failure;
extern crate flate2;
extern crate indicatif;
#[macro_use]
extern crate lazy_static;
extern crate parking_lot;
Expand All @@ -18,6 +17,7 @@ extern crate serde_json;
extern crate structopt;
#[macro_use]
extern crate slog;
extern crate humantime;
extern crate slog_async;
extern crate slog_term;
extern crate tar;
Expand Down
22 changes: 1 addition & 21 deletions src/progressbar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,18 @@

use console::style;
use emoji;
use indicatif::{ProgressBar, ProgressStyle};
use parking_lot::RwLock;
use std::fmt;

/// Synchronized progress bar and status message printing.
pub struct ProgressOutput {
spinner: RwLock<ProgressBar>,
messages: RwLock<String>,
}

impl ProgressOutput {
/// Construct a new `ProgressOutput`.
pub fn new() -> Self {
Self {
spinner: RwLock::new(ProgressBar::new_spinner()),
messages: RwLock::new(String::from("")),
}
}
Expand All @@ -29,20 +26,15 @@ impl ProgressOutput {
}

fn finish(&self) {
let spinner = self.spinner.read();
spinner.finish();

let mut message = self.messages.write();
print!("{}", *message);
message.clear();
}

/// Print the given message.
pub fn message(&self, message: &str) {
self.add_message(message);
self.finish();

let mut spinner = self.spinner.write();
*spinner = Self::progressbar(message);
}

fn add_message(&self, msg: &str) {
Expand Down Expand Up @@ -85,18 +77,6 @@ impl ProgressOutput {
self.add_message(&err);
}

fn progressbar(msg: &str) -> ProgressBar {
let pb = ProgressBar::new_spinner();
pb.enable_steady_tick(200);
pb.set_style(
ProgressStyle::default_spinner()
.tick_chars("/|\\- ")
.template("{spinner:.dim.bold} {wide_msg}"),
);
pb.set_message(&msg);
pb
}

/// After having built up a series of messages, print all of them out.
pub fn done(&self) {
self.finish();
Expand Down

0 comments on commit afc9a5c

Please sign in to comment.