summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexander Karlis <alexanderkarlis@gmail.com>2020-08-31 21:58:20 -0400
committerDavid Peter <sharkdp@users.noreply.github.com>2020-09-14 11:24:14 +0200
commitfdf11326efff48caf3c8c4d59a144c49948787f5 (patch)
tree334f98ae68a0b0fb9cfe394ddc17c5f584c8b211 /src
parent565a80305ca045e40eb5ba4b2fa127eb9d63e027 (diff)
added additional alias for color=always when always-decorations flag is triggered
Diffstat (limited to 'src')
-rw-r--r--src/bin/bat/app.rs14
-rw-r--r--src/bin/bat/clap_app.rs4
2 files changed, 11 insertions, 7 deletions
diff --git a/src/bin/bat/app.rs b/src/bin/bat/app.rs
index bb74b873..0858f6aa 100644
--- a/src/bin/bat/app.rs
+++ b/src/bin/bat/app.rs
@@ -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()
diff --git a/src/bin/bat/clap_app.rs b/src/bin/bat/clap_app.rs
index eed59a54..f6775ab5 100644
--- a/src/bin/bat/clap_app.rs
+++ b/src/bin/bat/clap_app.rs
@@ -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")