summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-01-11 05:06:41 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-01-11 05:06:41 -0500
commite47626633192b6b1e16d87587753d0dd6d683cab (patch)
tree41b12af9e7f512bce5bb763f2842bb140ac41e10
parent48331c92623aa3c3992a2dd827f9891bc00d276b (diff)
Don't colorize if output isn't a terminal
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--src/main.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 2ddb26d..a51c03a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -6,6 +6,7 @@ use std::error::Error;
use std::process::Command;
use clap::{Parser, Subcommand};
use colored::*;
+use colored::control::ShouldColorize;
use nom::number::complete::float;
use pager::Pager;
use serde_derive::{Serialize, Deserialize};
@@ -280,7 +281,7 @@ fn results_to_results_with_deltas(results: TestResultsVec) -> TestResultsDeltasV
}
fn list_tests(repo: &git2::Repository, head: &Option<String>) {
- colored::control::set_override(true);
+ colored::control::set_override(ShouldColorize::from_env().should_colorize());
Pager::with_pager("less -FRX").setup();
let results = results_read(RESULTS).unwrap();