on master help sign in
Add hidden --terminal-width option
8a52bcfsharkdp
src/app.rs+12−1
@@ -271,6 +271,13 @@ impl App {
271 'unbuffered'). The output is always unbuffered - this option \
271 'unbuffered'). The output is always unbuffered - this option \
272 is simply ignored.",
272 is simply ignored.",
273 ),
273 ),
274+ ).arg(
275+ Arg::with_name("terminal-width")
276+ .long("terminal-width")
277+ .takes_value(true)
278+ .value_name("width")
279+ .hidden(true)
280+ .help("Set the width of the terminal"),
274 ).subcommand(
281 ).subcommand(
275 SubCommand::with_name("cache")
282 SubCommand::with_name("cache")
276 .about("Modify the syntax-definition and theme cache")
283 .about("Modify the syntax-definition and theme cache")
@@ -367,7 +374,11 @@ impl App {
367 }
374 }
368 },
375 },
369 },
376 },
377+ term_width: self
378+ .matches
379+ .value_of("terminal-width")
380+ .and_then(|w| w.parse().ok())
370− term_width: Term::stdout().size().1 as usize,
381+ .unwrap_or(Term::stdout().size().1 as usize),
371 loop_through: !(self.interactive_output
382 loop_through: !(self.interactive_output
372 || self.matches.value_of("color") == Some("always")
383 || self.matches.value_of("color") == Some("always")
373 || self.matches.value_of("decorations") == Some("always")),
384 || self.matches.value_of("decorations") == Some("always")),