mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
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:
parent
0bda63a492
commit
7dfdaf200e
1 changed files with 6 additions and 1 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue