mirror of
https://github.com/sharkdp/bat.git
synced 2025-01-31 10:11:07 +00:00
Make -pp override --paging and vice versa when passed as a later argument. (#2660)
This commit is contained in:
parent
fe73010a5e
commit
e2bf85e749
@ -79,6 +79,7 @@ pub fn build_app(interactive_output: bool) -> Command {
|
|||||||
Arg::new("plain")
|
Arg::new("plain")
|
||||||
.overrides_with("plain")
|
.overrides_with("plain")
|
||||||
.overrides_with("number")
|
.overrides_with("number")
|
||||||
|
.overrides_with("paging")
|
||||||
.short('p')
|
.short('p')
|
||||||
.long("plain")
|
.long("plain")
|
||||||
.action(ArgAction::Count)
|
.action(ArgAction::Count)
|
||||||
@ -303,6 +304,7 @@ pub fn build_app(interactive_output: bool) -> Command {
|
|||||||
.long("paging")
|
.long("paging")
|
||||||
.overrides_with("paging")
|
.overrides_with("paging")
|
||||||
.overrides_with("no-paging")
|
.overrides_with("no-paging")
|
||||||
|
.overrides_with("plain")
|
||||||
.value_name("when")
|
.value_name("when")
|
||||||
.value_parser(["auto", "never", "always"])
|
.value_parser(["auto", "never", "always"])
|
||||||
.default_value("auto")
|
.default_value("auto")
|
||||||
|
@ -873,6 +873,42 @@ fn disable_pager_if_disable_paging_flag_comes_after_paging() {
|
|||||||
.stdout(predicate::eq("hello world\n").normalize());
|
.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")
|
||||||
|
.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]
|
#[test]
|
||||||
fn pager_failed_to_parse() {
|
fn pager_failed_to_parse() {
|
||||||
bat()
|
bat()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user