diff options
author | Alexander Karlis <alexanderkarlis@gmail.com> | 2020-09-11 22:54:47 -0400 |
---|---|---|
committer | David Peter <sharkdp@users.noreply.github.com> | 2020-09-14 11:24:14 +0200 |
commit | d349974089dc26a0f385a94a2d654537586a7f55 (patch) | |
tree | c11e7d012b6d5fa52c7b6c87dcda87dc5b4a5d0c /src | |
parent | ccdea6a429801c52967fa75868491f65b3b83ce7 (diff) |
updated PR based on comments
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/bat/app.rs | 5 | ||||
-rw-r--r-- | src/bin/bat/clap_app.rs | 13 | ||||
-rw-r--r-- | src/bin/bat/main.rs | 3 |
3 files changed, 14 insertions, 7 deletions
diff --git a/src/bin/bat/app.rs b/src/bin/bat/app.rs index 24cc7ac8..9e4d0f75 100644 --- a/src/bin/bat/app.rs +++ b/src/bin/bat/app.rs @@ -165,7 +165,7 @@ impl App { // There's no point in wrapping when this is the case. WrappingMode::NoWrapping }, - colored_output: self.matches.is_present("always-decorations") + colored_output: self.matches.is_present("force-colorization") || match self.matches.value_of("color") { Some("always") => true, Some("never") => false, @@ -178,7 +178,7 @@ impl App { loop_through: !(self.interactive_output || self.matches.value_of("color") == Some("always") || (self.matches.value_of("decorations") == Some("always") - || self.matches.is_present("always-decorations"))), + || self.matches.is_present("force-colorization"))), tab_width: self .matches .value_of("tabs") @@ -288,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 f6775ab5..385d017b 100644 --- a/src/bin/bat/clap_app.rs +++ b/src/bin/bat/clap_app.rs @@ -258,13 +258,16 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> { ), ) .arg( - Arg::with_name("always-decorations") + Arg::with_name("force-colorization") + .long("force-colorization") .short("f") - .alias("always-decor") - .overrides_with("always-decorations") - .hidden(true) + .conflicts_with("color") + .conflicts_with("decorations") + .overrides_with("force-colorization") .hidden_short_help(true) - .help("Alias for '--decorations=always --color=always'") + .long_help("Alias for '--decorations=always --color=always'. This is useful \ + if the output of bat is piped to another program, but you want \ + to keep the colorization/decorations.") ) .arg( Arg::with_name("paging") diff --git a/src/bin/bat/main.rs b/src/bin/bat/main.rs index 65129fa7..373712b3 100644 --- a/src/bin/bat/main.rs +++ b/src/bin/bat/main.rs @@ -209,6 +209,7 @@ fn run() -> Result<bool> { } else { let inputs = vec![Input::ordinary_file(OsStr::new("cache"))]; let config = app.config(&inputs)?; + println!("{:#?}", config); run_controller(inputs, &config) } @@ -217,6 +218,8 @@ fn run() -> Result<bool> { let inputs = app.inputs()?; let config = app.config(&inputs)?; + println!("{:#?}", config); + if app.matches.is_present("list-languages") { list_languages(&config)?; Ok(true) |