fix(help): Respect disable_colored_help for arg_required_else_help

Fixes #4671
This commit is contained in:
Ed Page 2023-01-24 15:53:00 -06:00
parent 10a87c662d
commit dc89379ff6

View file

@ -242,7 +242,10 @@ impl<F: ErrorFormatter> Error<F> {
/// ```
pub fn print(&self) -> io::Result<()> {
let style = self.formatted();
let color_when = if self.kind() == ErrorKind::DisplayHelp {
let color_when = if matches!(
self.kind(),
ErrorKind::DisplayHelp | ErrorKind::DisplayHelpOnMissingArgumentOrSubcommand,
) {
self.inner.color_help_when
} else {
self.inner.color_when