mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 08:50:19 +00:00
Add 'nocolor' option for output.
This maintains most output styles, but removes coloring from output. On Windows, this is the default setting if Full would have been used
This commit is contained in:
1 parent
faff3e680e
commit
faf00b6985
2 files changed
+17
-5
No files matched your search
@@ -24,6 +24,9 @@ pub enum OutputStyleOption {
|
||||
|
||||
/// Output with full color and formatting
|
||||
Full,
|
||||
|
||||
/// Keep elements such as progress bar, but use no coloring
|
||||
NoColor,
|
||||
}
|
||||
|
||||
/// A set of options for hyperfine
|
||||
@@ -64,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 => ProgressStyle::default_spinner()
|
||||
OutputStyleOption::Full | OutputStyleOption::NoColor => 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 => ProgressBar::new(length),
|
||||
OutputStyleOption::Full | OutputStyleOption::NoColor => ProgressBar::new(length),
|
||||
};
|
||||
progress_bar.set_style(progressbar_style.clone());
|
||||
progress_bar.enable_steady_tick(80);
|
||||
|
||||
Reference in new issue
Block a user