Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/bin/bat/clap_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ pub fn build_app(interactive_output: bool) -> Command {
Arg::new("plain")
.overrides_with("plain")
.overrides_with("number")
.overrides_with("paging")
.short('p')
.long("plain")
.action(ArgAction::Count)
Expand Down Expand Up @@ -303,6 +304,7 @@ pub fn build_app(interactive_output: bool) -> Command {
.long("paging")
.overrides_with("paging")
.overrides_with("no-paging")
.overrides_with("plain")
.value_name("when")
.value_parser(["auto", "never", "always"])
.default_value("auto")
Expand Down
36 changes: 36 additions & 0 deletions tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,42 @@ fn disable_pager_if_disable_paging_flag_comes_after_paging() {
.stdout(predicate::eq("hello world\n").normalize());
}

#[test]
fn disable_pager_if_pp_flag_comes_after_paging() {
bat()
.env("PAGER", "echo pager-output")
.arg("--paging=always")
.arg("-pp")
.arg("test.txt")
.assert()
.success()
.stdout(predicate::eq("hello world\n").normalize());
}

#[test]
fn enable_pager_if_disable_paging_flag_comes_before_paging() {
bat()
.env("PAGER", "echo pager-output")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the rebase @J-Kappes .

@boyvanduuren I don't understand how this new test can pass on Windows. It is rebased on your work, so shouldn't this need mocked_pagers::from()? Is CI not working as we expect?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is CI not working as we expect?

Seems so indeed. Running the tests locally on Windows/PS cause them to fail. I'll create a bug for this and take another look.

.arg("-P")
.arg("--paging=always")
.arg("test.txt")
.assert()
.success()
.stdout(predicate::eq("pager-output\n").normalize());
}

#[test]
fn enable_pager_if_pp_flag_comes_before_paging() {
bat()
.env("PAGER", "echo pager-output")
.arg("-pp")
.arg("--paging=always")
.arg("test.txt")
.assert()
.success()
.stdout(predicate::eq("pager-output\n").normalize());
}

#[test]
fn pager_failed_to_parse() {
bat()
Expand Down