mirror of
https://github.com/sharkdp/bat.git
synced 2024-11-26 09:43:51 +01:00
Add hidden --terminal-width option
This commit is contained in:
parent
0b1535f63b
commit
8a52bcf92d
13
src/app.rs
13
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")),
|
||||
|
Loading…
Reference in New Issue
Block a user