on master help sign in
added additional alias for color=always when always-decorations flag is triggered
commitfdf11326efff48caf3c8c4d59a144c49948787f5 authorAlexander Karlis <alexanderkarlis@gmail.com> dateMon 31 Aug 2020, 21:58 (6 years ago) parent565a803
2 files changed+11−7
src/bin/bat/app.rs+9−5 src/bin/bat/clap_app.rs+2−2
src/bin/bat/app.rs+9−5
@@ -165,11 +165,14 @@ impl App {
165165 // There's no point in wrapping when this is the case.
166166 WrappingMode::NoWrapping
167167 },
168− colored_output: match self.matches.value_of("color") {
169− Some("always") => true,
170− Some("never") => false,
171− Some("auto") | _ => env::var_os("NO_COLOR").is_none() && self.interactive_output,
172− },
168+ colored_output: self.matches.is_present("always-decorations")
169+ || match self.matches.value_of("color") {
170+ Some("always") => true,
171+ Some("never") => false,
172+ Some("auto") | _ => {
173+ env::var_os("NO_COLOR").is_none() && self.interactive_output
174+ }
175+ },
173176 paging_mode,
174177 term_width: maybe_term_width.unwrap_or(Term::stdout().size().1 as usize),
175178 loop_through: !(self.interactive_output
@@ -285,6 +288,7 @@ impl App {
285288
286289 fn style_components(&self) -> Result<StyleComponents> {
287290 let matches = &self.matches;
291+ println!("{:#?}", matches);
288292 Ok(StyleComponents(
289293 if matches.value_of("decorations") == Some("never") {
290294 HashSet::new()
src/bin/bat/clap_app.rs+2−2
@@ -259,12 +259,12 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
259259 )
260260 .arg(
261261 Arg::with_name("always-decorations")
262− .short("D")
262+ .short("f")
263263 .alias("always-decor")
264264 .overrides_with("always-decorations")
265265 .hidden(true)
266266 .hidden_short_help(true)
267− .help("Alias for '--decorations=always'")
267+ .help("Alias for '--decorations=always --color=always'")
268268 )
269269 .arg(
270270 Arg::with_name("paging")