on master help sign in
Add -pp for plain styling and no pager
commitfde00eec98035b59d3c91b65c0746f81252e3184 authorEthan P <eth-p+git@hidden.email> dateWed 8 May 2019, 18:56 (8 years ago) parentbb6594e
2 files changed+7−3
src/app.rs+4−1 src/clap_app.rs+3−2
src/app.rs+4−1
@@ -143,7 +143,10 @@ impl App {
143143 Some("always") => PagingMode::Always,
144144 Some("never") => PagingMode::Never,
145145 Some("auto") | _ => {
146− if files.contains(&InputFile::StdIn) {
146+ if self.matches.occurrences_of("plain") > 1 {
147+ // If we have -pp as an option when in auto mode, the pager should be disabled.
148+ PagingMode::Never
149+ } else if files.contains(&InputFile::StdIn) {
147150 // If we are reading from stdin, only enable paging if we write to an
148151 // interactive terminal and if we do not *read* from an interactive
149152 // terminal.
src/clap_app.rs+3−2
@@ -143,10 +143,11 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
143143 .overrides_with("number")
144144 .short("p")
145145 .long("plain")
146+ .multiple(true)
146147 .help("Show plain style (alias for '--style=plain').")
147148 .long_help(
148− "Only show plain style, no decorations. This is an alias for \
149− '--style=plain'",
149+ "Only show plain style, no decorations. When '-p' is used, this is an alias for \
150+ '--style=plain'. When '-pp' is used, this is an alias for '--style=plain --pager=never'.",
150151 ),
151152 )
152153 .arg(