Skip to content

Commit

Permalink
Make the no-paging option override earlier paging options
Browse files Browse the repository at this point in the history
  • Loading branch information
themkat committed May 24, 2022
1 parent e9f8370 commit f7f3e2b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/bin/bat/clap_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
Arg::with_name("paging")
.long("paging")
.overrides_with("paging")
.overrides_with("no-paging")
.takes_value(true)
.value_name("when")
.possible_values(&["auto", "never", "always"])
Expand Down
12 changes: 12 additions & 0 deletions tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,18 @@ fn alias_pager_disable_long_overrides_short() {
.stdout(predicate::eq("pager-output\n").normalize());
}

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

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

0 comments on commit f7f3e2b

Please sign in to comment.