Allow offset values in --terminal-width

Allows the `width` argument to `--terminal-width` to be an offset
instead of an absolute number. Examples:

    --terminal-width=80   # Set output width to 80 characters
    --terminal-width=-2   # Set output width to actual_width - 2

closes #376
This commit is contained in:
sharkdp authored and David Peter committed 2018-10-31 22:21:22 +01:00
1 parent 78f26d0caf
commit dda27b253b
2 files changed
+23 -3

No files matched your search

+6 -2
View File
@@ -287,8 +287,12 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
.long("terminal-width")
.takes_value(true)
.value_name("width")
.hidden(true)
.help("Set the width of the terminal"),
.hidden_short_help(true)
.help(
"Explicitly set the width of the terminal instead of determining it \
automatically. If prefixed with '+' or '-', the value will be treated \
as an offset to the actual terminal width.",
),
)
.arg(
Arg::with_name("no-config")