Skip to content

Commit

Permalink
fix(error): Never show unrequested color
Browse files Browse the repository at this point in the history
If the user prints a raw error, it may include color even if the user
turned it off at runtime.  Now we'll be more conservative and never show
color for raw errors.

This is a follow up to clap-rs#2943; apparently I had missed some cases.
  • Loading branch information
epage committed Oct 29, 2021
1 parent 7ce5d79 commit 6126f99
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/parse/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ impl Error {
val: String,
err: Box<dyn error::Error + Send + Sync>,
) -> Self {
Self::value_validation_with_color(arg, val, err, ColorChoice::Auto)
Self::value_validation_with_color(arg, val, err, ColorChoice::Never)
}

fn value_validation_with_color(
Expand Down Expand Up @@ -996,7 +996,7 @@ impl Error {
}

pub(crate) fn argument_not_found_auto(arg: String) -> Self {
let mut c = Colorizer::new(true, ColorChoice::Auto);
let mut c = Colorizer::new(true, ColorChoice::Never);

start_error(&mut c, "The argument '");
c.warning(arg.clone());
Expand Down

0 comments on commit 6126f99

Please sign in to comment.