mirror of
https://github.com/sharkdp/bat
synced 2026-06-09 10:03:18 +00:00
warn when pager is missing instead of silently falling back
when a configured pager (via BAT_PAGER, PAGER, or --pager) is not found, bat now shows a warning message before falling back to stdout. this helps users understand why their pager isn't running and makes it obvious when there's a typo or PATH issue. fixes issue #2904
This commit is contained in:
@@ -1425,6 +1425,21 @@ fn pager_failed_to_parse() {
|
||||
.stderr(predicate::str::contains("Could not parse pager command"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
fn pager_missing_warning() {
|
||||
bat()
|
||||
.env("BAT_PAGER", "nonexistent-pager-xyz-missing")
|
||||
.arg("--paging=always")
|
||||
.arg("test.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stderr(predicate::str::contains("[bat warning]"))
|
||||
.stderr(predicate::str::contains("not found"))
|
||||
.stderr(predicate::str::contains("nonexistent-pager-xyz-missing"))
|
||||
.stdout(predicate::str::contains("hello world\n"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
fn env_var_bat_paging() {
|
||||
|
||||
Reference in New Issue
Block a user