on master help sign in
Add hidden --terminal-width option
commit8a52bcf92d6b2f03d1ca25ed4281cc5111b40b30 authorsharkdp <davidpeter@web.de> dateFri 31 Aug 2018, 22:52 (8 years ago) parent0b1535f
1 file changed+12−1
src/app.rs+12−1
src/app.rs+12−1
@@ -271,6 +271,13 @@ impl App {
271271 'unbuffered'). The output is always unbuffered - this option \
272272 is simply ignored.",
273273 ),
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"),
274281 ).subcommand(
275282 SubCommand::with_name("cache")
276283 .about("Modify the syntax-definition and theme cache")
@@ -367,7 +374,11 @@ impl App {
367374 }
368375 },
369376 },
370− term_width: Term::stdout().size().1 as usize,
377+ term_width: self
378+ .matches
379+ .value_of("terminal-width")
380+ .and_then(|w| w.parse().ok())
381+ .unwrap_or(Term::stdout().size().1 as usize),
371382 loop_through: !(self.interactive_output
372383 || self.matches.value_of("color") == Some("always")
373384 || self.matches.value_of("decorations") == Some("always")),