Skip to content

Commit

Permalink
fix(color): Allow overriding previous settings
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Feb 11, 2022
1 parent bdb034b commit 547665d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/build/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -859,11 +859,15 @@ impl<'help> App<'help> {
#[inline]
#[must_use]
pub fn color(self, color: ColorChoice) -> Self {
#[allow(deprecated)]
#![allow(deprecated)]
let app = self
.unset_global_setting(AppSettings::ColorAuto)
.unset_global_setting(AppSettings::ColorAlways)
.unset_global_setting(AppSettings::ColorNever);
match color {
ColorChoice::Auto => self.global_setting(AppSettings::ColorAuto),
ColorChoice::Always => self.global_setting(AppSettings::ColorAlways),
ColorChoice::Never => self.global_setting(AppSettings::ColorNever),
ColorChoice::Auto => app.global_setting(AppSettings::ColorAuto),
ColorChoice::Always => app.global_setting(AppSettings::ColorAlways),
ColorChoice::Never => app.global_setting(AppSettings::ColorNever),
}
}

Expand Down

0 comments on commit 547665d

Please sign in to comment.