mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 08:50:19 +00:00
Make checks more concise
This commit is contained in:
1 parent
faf00b6985
commit
4829dfbc85
2 files changed
+4
-6
No files matched your search
@@ -67,14 +67,14 @@ impl Default for HyperfineOptions {
|
|||||||
pub fn get_progress_bar(length: u64, msg: &str, option: &OutputStyleOption) -> ProgressBar {
|
pub fn get_progress_bar(length: u64, msg: &str, option: &OutputStyleOption) -> ProgressBar {
|
||||||
let progressbar_style = match *option {
|
let progressbar_style = match *option {
|
||||||
OutputStyleOption::Basic => ProgressStyle::default_bar(),
|
OutputStyleOption::Basic => ProgressStyle::default_bar(),
|
||||||
OutputStyleOption::Full | OutputStyleOption::NoColor => ProgressStyle::default_spinner()
|
_ => ProgressStyle::default_spinner()
|
||||||
.tick_chars("⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏")
|
.tick_chars("⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏")
|
||||||
.template(" {spinner} {msg:<30} {wide_bar} ETA {eta_precise}"),
|
.template(" {spinner} {msg:<30} {wide_bar} ETA {eta_precise}"),
|
||||||
};
|
};
|
||||||
|
|
||||||
let progress_bar = match *option {
|
let progress_bar = match *option {
|
||||||
OutputStyleOption::Basic => ProgressBar::hidden(),
|
OutputStyleOption::Basic => ProgressBar::hidden(),
|
||||||
OutputStyleOption::Full | OutputStyleOption::NoColor => ProgressBar::new(length),
|
_ => ProgressBar::new(length),
|
||||||
};
|
};
|
||||||
progress_bar.set_style(progressbar_style.clone());
|
progress_bar.set_style(progressbar_style.clone());
|
||||||
progress_bar.enable_steady_tick(80);
|
progress_bar.enable_steady_tick(80);
|
||||||
|
|||||||
+2
-4
@@ -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 {
|
if cfg!(windows) && options.output_style == OutputStyleOption::Full {
|
||||||
options.output_style = OutputStyleOption::NoColor;
|
options.output_style = OutputStyleOption::NoColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
if options.output_style == OutputStyleOption::Basic
|
if options.output_style != OutputStyleOption::Full {
|
||||||
|| options.output_style == OutputStyleOption::NoColor
|
|
||||||
{
|
|
||||||
colored::control::set_override(false);
|
colored::control::set_override(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user