mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 17:00:18 +00:00
Compact output, add -s color option, closes #70
Strip the empty lines within the results for each benchmark, but keep the empty line between each benchmark, and before the summary. Add `color` style option to show color but not be interactive (no progress bar).
This commit is contained in:
1 parent
4b8f47d6f2
commit
3246ec27e1
5 files changed
+14
-10
No files matched your search
@@ -12,14 +12,14 @@ pub const MIN_EXECUTION_TIME: Second = 5e-3;
|
||||
/// Return a pre-configured progress bar
|
||||
pub fn get_progress_bar(length: u64, msg: &str, option: &OutputStyleOption) -> ProgressBar {
|
||||
let progressbar_style = match *option {
|
||||
OutputStyleOption::Basic => ProgressStyle::default_bar(),
|
||||
OutputStyleOption::Basic | OutputStyleOption::Color => ProgressStyle::default_bar(),
|
||||
_ => ProgressStyle::default_spinner()
|
||||
.tick_chars("⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏")
|
||||
.template(" {spinner} {msg:<30} {wide_bar} ETA {eta_precise}"),
|
||||
.template("\n {spinner} {msg:<30} {wide_bar} ETA {eta_precise}"),
|
||||
};
|
||||
|
||||
let progress_bar = match *option {
|
||||
OutputStyleOption::Basic => ProgressBar::hidden(),
|
||||
OutputStyleOption::Basic | OutputStyleOption::Color => ProgressBar::hidden(),
|
||||
_ => ProgressBar::new(length),
|
||||
};
|
||||
progress_bar.set_style(progressbar_style.clone());
|
||||
@@ -63,7 +63,7 @@ pub fn write_benchmark_comparison(results: &Vec<BenchmarkResult>) {
|
||||
}
|
||||
}
|
||||
|
||||
println!("{}\n", "Summary".bold());
|
||||
println!("{}", "Summary".bold());
|
||||
println!(" '{}' ran", fastest_item.command.cyan());
|
||||
longer_items.sort_by(|l, r| l.mean.partial_cmp(&r.mean).unwrap_or(Ordering::Equal));
|
||||
|
||||
|
||||
Reference in new issue
Block a user