From ab639eea67e830ab27f51adb2665c73d93c682c7 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 10 Sep 2018 00:19:50 +0200 Subject: add a flag to disable colored output --- src/main.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 31e29ad..9343e14 100644 --- a/src/main.rs +++ b/src/main.rs @@ -49,6 +49,10 @@ struct Opt { #[structopt(short = "o", long = "outcome")] outcome: Option, + /// Disable colored output. + #[structopt(long = "no-color")] + no_color: bool, + /// The regular expression to search for. #[structopt(name = "EXPR")] expression: Regex, @@ -141,6 +145,11 @@ impl FromStr for FightOutcome { fn main() { let opt = Opt::from_args(); + + if opt.no_color { + colored::control::set_override(false); + } + let result = grep(&opt); match result { Ok(_) => {} -- cgit v1.2.3