feat(Help): adds new short hand way to use source formatting and ignore term width in help messages

Prior to this commit if one wished to use source formatting and ignore
term width they could do `App::set_term_width(usize::MAX)` now one can
also use `App::set_term_width(0)` which does the same thing.

Closes #625
This commit is contained in:
Kevin K 2016-08-24 19:32:10 -04:00
parent 0bda63a492
commit 7dfdaf200e

View file

@ -2,6 +2,7 @@ use std::io::{self, Cursor, Read, Write};
use std::collections::BTreeMap;
use std::fmt::Display;
use std::cmp;
use std::usize;
use vec_map::VecMap;
@ -102,7 +103,11 @@ impl<'a> Help<'a> {
next_line_help: next_line_help,
hide_pv: hide_pv,
term_w: match term_w {
Some(width) => width,
Some(width) => if width == 0 {
usize::MAX
} else {
width
},
None => term_size::dimensions().map_or(120, |(w, _)| w),
},
color: color,