mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 14:52:33 +00:00
fix(error): Never show unrequested color
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 #2943; apparently I had missed some cases.
This commit is contained in:
parent
7ce5d79de3
commit
6126f998d1
1 changed files with 2 additions and 2 deletions
|
@ -870,7 +870,7 @@ impl Error {
|
||||||
val: String,
|
val: String,
|
||||||
err: Box<dyn error::Error + Send + Sync>,
|
err: Box<dyn error::Error + Send + Sync>,
|
||||||
) -> Self {
|
) -> 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(
|
fn value_validation_with_color(
|
||||||
|
@ -996,7 +996,7 @@ impl Error {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn argument_not_found_auto(arg: String) -> Self {
|
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 '");
|
start_error(&mut c, "The argument '");
|
||||||
c.warning(arg.clone());
|
c.warning(arg.clone());
|
||||||
|
|
Loading…
Reference in a new issue