From 89217e0d58a9a371540d11eded538721d71c90c7 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Mon, 9 Aug 2021 10:54:32 +0200 Subject: Make --no-paging and --no-pager work again --- src/bin/bat/clap_app.rs | 1 + tests/integration_tests.rs | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/src/bin/bat/clap_app.rs b/src/bin/bat/clap_app.rs index 57e070af..2ac0eba5 100644 --- a/src/bin/bat/clap_app.rs +++ b/src/bin/bat/clap_app.rs @@ -294,6 +294,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> { .arg( Arg::with_name("no-paging") .short("P") + .long("no-paging") .alias("no-pager") .overrides_with("no-paging") .hidden(true) diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index d2c8501f..18f16123 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -1122,6 +1122,42 @@ fn show_all_mode() { .stderr(""); } +#[test] +fn no_paging_arg() { + bat() + .arg("--no-paging") + .arg("--color=never") + .arg("--decorations=never") + .arg("single-line.txt") + .assert() + .success() + .stdout("Single Line"); +} + +#[test] +fn no_paging_short_arg() { + bat() + .arg("-P") + .arg("--color=never") + .arg("--decorations=never") + .arg("single-line.txt") + .assert() + .success() + .stdout("Single Line"); +} + +#[test] +fn no_pager_arg() { + bat() + .arg("--no-pager") + .arg("--color=never") + .arg("--decorations=never") + .arg("single-line.txt") + .assert() + .success() + .stdout("Single Line"); +} + #[test] fn plain_mode_does_not_add_nonexisting_newline() { bat() -- cgit v1.2.3