Fix: Do not automatically wrap text

We must use `ArgMatches::occurrences_of` here to check whether the
argument was actually passed.

If it was not passed, we do not wrap at all.
This commit is contained in:
Matthias Beyer 2018-04-22 14:17:12 +02:00
parent 495ad62be6
commit 10b71864f6
1 changed files with 1 additions and 1 deletions

View File

@ -173,7 +173,7 @@ fn main() {
} else {
let mut viewer = StdoutViewer::new(view_header, !hide_content);
if rt.cli().is_present("autowrap") {
if rt.cli().occurrences_of("autowrap") != 0 {
let width = rt.cli().value_of("autowrap").unwrap(); // ensured by clap
let width = usize::from_str(width).unwrap_or_else(|e| {
error!("Failed to parse argument to number: autowrap = {:?}",