on master help sign in
updated PR based on comments
commitd349974089dc26a0f385a94a2d654537586a7f55 authorAlexander Karlis <alexanderkarlis@gmail.com> dateFri 11 Sep 2020, 22:54 (6 years ago) parentccdea6a
3 files changed+14−7
src/bin/bat/app.rs+3−2 src/bin/bat/clap_app.rs+8−5 src/bin/bat/main.rs+3
src/bin/bat/app.rs+3−2
@@ -165,7 +165,7 @@ impl App {
165165 // There's no point in wrapping when this is the case.
166166 WrappingMode::NoWrapping
167167 },
168− colored_output: self.matches.is_present("always-decorations")
168+ colored_output: self.matches.is_present("force-colorization")
169169 || match self.matches.value_of("color") {
170170 Some("always") => true,
171171 Some("never") => false,
@@ -178,7 +178,7 @@ impl App {
178178 loop_through: !(self.interactive_output
179179 || self.matches.value_of("color") == Some("always")
180180 || (self.matches.value_of("decorations") == Some("always")
181− || self.matches.is_present("always-decorations"))),
181+ || self.matches.is_present("force-colorization"))),
182182 tab_width: self
183183 .matches
184184 .value_of("tabs")
@@ -288,6 +288,7 @@ impl App {
288288
289289 fn style_components(&self) -> Result<StyleComponents> {
290290 let matches = &self.matches;
291+ println!("{:#?}", matches);
291292 Ok(StyleComponents(
292293 if matches.value_of("decorations") == Some("never") {
293294 HashSet::new()
src/bin/bat/clap_app.rs+8−5
@@ -258,13 +258,16 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
258258 ),
259259 )
260260 .arg(
261− Arg::with_name("always-decorations")
261+ Arg::with_name("force-colorization")
262+ .long("force-colorization")
262263 .short("f")
263− .alias("always-decor")
264− .overrides_with("always-decorations")
265− .hidden(true)
264+ .conflicts_with("color")
265+ .conflicts_with("decorations")
266+ .overrides_with("force-colorization")
266267 .hidden_short_help(true)
267− .help("Alias for '--decorations=always --color=always'")
268+ .long_help("Alias for '--decorations=always --color=always'. This is useful \
269+ if the output of bat is piped to another program, but you want \
270+ to keep the colorization/decorations.")
268271 )
269272 .arg(
270273 Arg::with_name("paging")
src/bin/bat/main.rs+3
@@ -209,6 +209,7 @@ fn run() -> Result<bool> {
209209 } else {
210210 let inputs = vec![Input::ordinary_file(OsStr::new("cache"))];
211211 let config = app.config(&inputs)?;
212+ println!("{:#?}", config);
212213
213214 run_controller(inputs, &config)
214215 }
@@ -217,6 +218,8 @@ fn run() -> Result<bool> {
217218 let inputs = app.inputs()?;
218219 let config = app.config(&inputs)?;
219220
221+ println!("{:#?}", config);
222+
220223 if app.matches.is_present("list-languages") {
221224 list_languages(&config)?;
222225 Ok(true)