added additional alias for color=always when always-decorations flag is triggered

This commit is contained in:
Alexander Karlis 2020-08-31 21:58:20 -04:00 committed by David Peter
parent 565a80305c
commit fdf11326ef
2 changed files with 11 additions and 7 deletions

View File

@ -165,11 +165,14 @@ impl App {
// There's no point in wrapping when this is the case.
WrappingMode::NoWrapping
},
colored_output: match self.matches.value_of("color") {
Some("always") => true,
Some("never") => false,
Some("auto") | _ => env::var_os("NO_COLOR").is_none() && self.interactive_output,
},
colored_output: self.matches.is_present("always-decorations")
|| match self.matches.value_of("color") {
Some("always") => true,
Some("never") => false,
Some("auto") | _ => {
env::var_os("NO_COLOR").is_none() && self.interactive_output
}
},
paging_mode,
term_width: maybe_term_width.unwrap_or(Term::stdout().size().1 as usize),
loop_through: !(self.interactive_output
@ -285,6 +288,7 @@ impl App {
fn style_components(&self) -> Result<StyleComponents> {
let matches = &self.matches;
println!("{:#?}", matches);
Ok(StyleComponents(
if matches.value_of("decorations") == Some("never") {
HashSet::new()

View File

@ -259,12 +259,12 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
)
.arg(
Arg::with_name("always-decorations")
.short("D")
.short("f")
.alias("always-decor")
.overrides_with("always-decorations")
.hidden(true)
.hidden_short_help(true)
.help("Alias for '--decorations=always'")
.help("Alias for '--decorations=always --color=always'")
)
.arg(
Arg::with_name("paging")