Skip to content

Commit

Permalink
Make checks more concise
Browse files Browse the repository at this point in the history
  • Loading branch information
stevepentland authored and sharkdp committed Feb 20, 2018
1 parent faf00b6 commit 4829dfb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/hyperfine/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ impl Default for HyperfineOptions {
pub fn get_progress_bar(length: u64, msg: &str, option: &OutputStyleOption) -> ProgressBar {
let progressbar_style = match *option {
OutputStyleOption::Basic => ProgressStyle::default_bar(),
OutputStyleOption::Full | OutputStyleOption::NoColor => ProgressStyle::default_spinner()
_ => ProgressStyle::default_spinner()
.tick_chars("⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏")
.template(" {spinner} {msg:<30} {wide_bar} ETA {eta_precise}"),
};

let progress_bar = match *option {
OutputStyleOption::Basic => ProgressBar::hidden(),
OutputStyleOption::Full | OutputStyleOption::NoColor => ProgressBar::new(length),
_ => ProgressBar::new(length),
};
progress_bar.set_style(progressbar_style.clone());
progress_bar.enable_steady_tick(80);
Expand Down
6 changes: 2 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,12 @@ fn main() {
},
};

// We default Windows to NoColor if full or auto had been specified.
// We default Windows to NoColor if full had been specified.
if cfg!(windows) && options.output_style == OutputStyleOption::Full {
options.output_style = OutputStyleOption::NoColor;
}

if options.output_style == OutputStyleOption::Basic
|| options.output_style == OutputStyleOption::NoColor
{
if options.output_style != OutputStyleOption::Full {
colored::control::set_override(false);
}

Expand Down

0 comments on commit 4829dfb

Please sign in to comment.