mirror of
https://github.com/sharkdp/hyperfine.git
synced 2024-10-26 22:21:58 +03:00
Enable colors on Windows, closes #427
This commit is contained in:
parent
5c6b302591
commit
5f553cb91a
@ -145,6 +145,10 @@ fn main() {
|
|||||||
fn build_hyperfine_options<'a>(
|
fn build_hyperfine_options<'a>(
|
||||||
matches: &ArgMatches<'a>,
|
matches: &ArgMatches<'a>,
|
||||||
) -> Result<HyperfineOptions, OptionsError<'a>> {
|
) -> Result<HyperfineOptions, OptionsError<'a>> {
|
||||||
|
// Enabled ANSI colors on Windows 10
|
||||||
|
#[cfg(windows)]
|
||||||
|
colored::control::set_virtual_terminal(true).unwrap();
|
||||||
|
|
||||||
let mut options = HyperfineOptions::default();
|
let mut options = HyperfineOptions::default();
|
||||||
let param_to_u64 = |param| {
|
let param_to_u64 = |param| {
|
||||||
matches
|
matches
|
||||||
@ -216,11 +220,6 @@ fn build_hyperfine_options<'a>(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// We default Windows to NoColor if full had been specified.
|
|
||||||
if cfg!(windows) && options.output_style == OutputStyleOption::Full {
|
|
||||||
options.output_style = OutputStyleOption::NoColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
match options.output_style {
|
match options.output_style {
|
||||||
OutputStyleOption::Basic | OutputStyleOption::NoColor => {
|
OutputStyleOption::Basic | OutputStyleOption::NoColor => {
|
||||||
colored::control::set_override(false)
|
colored::control::set_override(false)
|
||||||
|
Loading…
Reference in New Issue
Block a user