From fde00eec98035b59d3c91b65c0746f81252e3184 Mon Sep 17 00:00:00 2001 From: Ethan P Date: Wed, 8 May 2019 18:56:02 -0700 Subject: [PATCH] Add -pp for plain styling and no pager --- src/app.rs | 5 ++++- src/clap_app.rs | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app.rs b/src/app.rs index 4f524c9c..47af9e9c 100644 --- a/src/app.rs +++ b/src/app.rs @@ -143,7 +143,10 @@ impl App { Some("always") => PagingMode::Always, Some("never") => PagingMode::Never, Some("auto") | _ => { - if files.contains(&InputFile::StdIn) { + if self.matches.occurrences_of("plain") > 1 { + // If we have -pp as an option when in auto mode, the pager should be disabled. + PagingMode::Never + } else if files.contains(&InputFile::StdIn) { // If we are reading from stdin, only enable paging if we write to an // interactive terminal and if we do not *read* from an interactive // terminal. diff --git a/src/clap_app.rs b/src/clap_app.rs index c34d8b68..16b671ad 100644 --- a/src/clap_app.rs +++ b/src/clap_app.rs @@ -143,10 +143,11 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> { .overrides_with("number") .short("p") .long("plain") + .multiple(true) .help("Show plain style (alias for '--style=plain').") .long_help( - "Only show plain style, no decorations. This is an alias for \ - '--style=plain'", + "Only show plain style, no decorations. When '-p' is used, this is an alias for \ + '--style=plain'. When '-pp' is used, this is an alias for '--style=plain --pager=never'.", ), ) .arg(