on master help sign in
added additional alias for color=always when always-decorations flag is triggered
fdf1132Alexander Karlis
src/bin/bat/app.rs+9−5
@@ -165,11 +165,14 @@ impl App {
165 // There's no point in wrapping when this is the case.
165 // There's no point in wrapping when this is the case.
166 WrappingMode::NoWrapping
166 WrappingMode::NoWrapping
167 },
167 },
168+ colored_output: self.matches.is_present("always-decorations")
168− colored_output: match self.matches.value_of("color") {
169+ || match self.matches.value_of("color") {
169− Some("always") => true,
170+ Some("always") => true,
170− Some("never") => false,
171+ Some("never") => false,
172+ Some("auto") | _ => {
171− Some("auto") | _ => env::var_os("NO_COLOR").is_none() && self.interactive_output,
173+ env::var_os("NO_COLOR").is_none() && self.interactive_output
174+ }
172− },
175+ },
173 paging_mode,
176 paging_mode,
174 term_width: maybe_term_width.unwrap_or(Term::stdout().size().1 as usize),
177 term_width: maybe_term_width.unwrap_or(Term::stdout().size().1 as usize),
175 loop_through: !(self.interactive_output
178 loop_through: !(self.interactive_output
@@ -285,6 +288,7 @@ impl App {
285
288
286 fn style_components(&self) -> Result<StyleComponents> {
289 fn style_components(&self) -> Result<StyleComponents> {
287 let matches = &self.matches;
290 let matches = &self.matches;
291+ println!("{:#?}", matches);
288 Ok(StyleComponents(
292 Ok(StyleComponents(
289 if matches.value_of("decorations") == Some("never") {
293 if matches.value_of("decorations") == Some("never") {
290 HashSet::new()
294 HashSet::new()
src/bin/bat/clap_app.rs+2−2
@@ -259,12 +259,12 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
259 )
259 )
260 .arg(
260 .arg(
261 Arg::with_name("always-decorations")
261 Arg::with_name("always-decorations")
262− .short("D")
262+ .short("f")
263 .alias("always-decor")
263 .alias("always-decor")
264 .overrides_with("always-decorations")
264 .overrides_with("always-decorations")
265 .hidden(true)
265 .hidden(true)
266 .hidden_short_help(true)
266 .hidden_short_help(true)
267− .help("Alias for '--decorations=always'")
267+ .help("Alias for '--decorations=always --color=always'")
268 )
268 )
269 .arg(
269 .arg(
270 Arg::with_name("paging")
270 Arg::with_name("paging")