on master help sign in
updated PR based on comments
d349974Alexander Karlis
src/bin/bat/app.rs+3−2
@@ -165,7 +165,7 @@ 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: self.matches.is_present("force-colorization")
169 || match self.matches.value_of("color") {
169 || match self.matches.value_of("color") {
170 Some("always") => true,
170 Some("always") => true,
171 Some("never") => false,
171 Some("never") => false,
@@ -178,7 +178,7 @@ impl App {
178 loop_through: !(self.interactive_output
178 loop_through: !(self.interactive_output
179 || self.matches.value_of("color") == Some("always")
179 || self.matches.value_of("color") == Some("always")
180 || (self.matches.value_of("decorations") == Some("always")
180 || (self.matches.value_of("decorations") == Some("always")
181− || self.matches.is_present("always-decorations"))),
181+ || self.matches.is_present("force-colorization"))),
182 tab_width: self
182 tab_width: self
183 .matches
183 .matches
184 .value_of("tabs")
184 .value_of("tabs")
@@ -288,6 +288,7 @@ impl App {
288
288
289 fn style_components(&self) -> Result<StyleComponents> {
289 fn style_components(&self) -> Result<StyleComponents> {
290 let matches = &self.matches;
290 let matches = &self.matches;
291+ println!("{:#?}", matches);
291 Ok(StyleComponents(
292 Ok(StyleComponents(
292 if matches.value_of("decorations") == Some("never") {
293 if matches.value_of("decorations") == Some("never") {
293 HashSet::new()
294 HashSet::new()
src/bin/bat/clap_app.rs+8−5
@@ -258,13 +258,16 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
258 ),
258 ),
259 )
259 )
260 .arg(
260 .arg(
261− Arg::with_name("always-decorations")
261+ Arg::with_name("force-colorization")
262+ .long("force-colorization")
262 .short("f")
263 .short("f")
263− .alias("always-decor")
264+ .conflicts_with("color")
265+ .conflicts_with("decorations")
264− .overrides_with("always-decorations")
266+ .overrides_with("force-colorization")
265− .hidden(true)
266 .hidden_short_help(true)
267 .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.")
268 )
271 )
269 .arg(
272 .arg(
270 Arg::with_name("paging")
273 Arg::with_name("paging")
src/bin/bat/main.rs+3
@@ -209,6 +209,7 @@ fn run() -> Result<bool> {
209 } else {
209 } else {
210 let inputs = vec![Input::ordinary_file(OsStr::new("cache"))];
210 let inputs = vec![Input::ordinary_file(OsStr::new("cache"))];
211 let config = app.config(&inputs)?;
211 let config = app.config(&inputs)?;
212+ println!("{:#?}", config);
212
213
213 run_controller(inputs, &config)
214 run_controller(inputs, &config)
214 }
215 }
@@ -217,6 +218,8 @@ fn run() -> Result<bool> {
217 let inputs = app.inputs()?;
218 let inputs = app.inputs()?;
218 let config = app.config(&inputs)?;
219 let config = app.config(&inputs)?;
219
220
221+ println!("{:#?}", config);
222+
220 if app.matches.is_present("list-languages") {
223 if app.matches.is_present("list-languages") {
221 list_languages(&config)?;
224 list_languages(&config)?;
222 Ok(true)
225 Ok(true)