Make --no-paging and --no-pager work again

This commit is contained in:
Martin Nordholts 2021-08-09 10:54:32 +02:00
parent cb4973987b
commit 89217e0d58
2 changed files with 37 additions and 0 deletions

View File

@ -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)

View File

@ -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()