summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsharkdp <davidpeter@web.de>2018-08-31 22:52:22 +0200
committerDavid Peter <sharkdp@users.noreply.github.com>2018-08-31 23:57:27 +0200
commit8a52bcf92d6b2f03d1ca25ed4281cc5111b40b30 (patch)
tree19c94ba7b78d96739f554f337a88f5aacb25d06b
parent0b1535f63b7f1484623a17a073c59f83af7d733c (diff)
Add hidden --terminal-width option
-rw-r--r--src/app.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/app.rs b/src/app.rs
index 40364c6b..37fbd530 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -271,6 +271,13 @@ impl App {
'unbuffered'). The output is always unbuffered - this option \
is simply ignored.",
),
+ ).arg(
+ Arg::with_name("terminal-width")
+ .long("terminal-width")
+ .takes_value(true)
+ .value_name("width")
+ .hidden(true)
+ .help("Set the width of the terminal"),
).subcommand(
SubCommand::with_name("cache")
.about("Modify the syntax-definition and theme cache")
@@ -367,7 +374,11 @@ impl App {
}
},
},
- term_width: Term::stdout().size().1 as usize,
+ term_width: self
+ .matches
+ .value_of("terminal-width")
+ .and_then(|w| w.parse().ok())
+ .unwrap_or(Term::stdout().size().1 as usize),
loop_through: !(self.interactive_output
|| self.matches.value_of("color") == Some("always")
|| self.matches.value_of("decorations") == Some("always")),