mirror of
https://github.com/sharkdp/bat.git
synced 2025-04-18 16:50:33 +01:00
parent
f4202361b4
commit
986d0e9777
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
## Bugfixes
|
## Bugfixes
|
||||||
|
|
||||||
|
- Ignore PAGER=most by default with a warning to stderr, but allow override with BAT_PAGER or --config, see #1063 (@Enselic)
|
||||||
|
|
||||||
## Other
|
## Other
|
||||||
|
|
||||||
## Syntaxes
|
## Syntaxes
|
||||||
|
@ -66,6 +66,11 @@ impl OutputType {
|
|||||||
return Err(ErrorKind::InvalidPagerValueBat.into());
|
return Err(ErrorKind::InvalidPagerValueBat.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if pager_path.file_stem() == Some(&OsString::from("most")) && source == PagerSource::PagerEnvVar {
|
||||||
|
eprintln!("WARNING: Ignoring PAGER=\"{}\": Coloring not supported. Override with BAT_PAGER=\"{}\" or --pager \"{}\"", pager, pager, pager);
|
||||||
|
return Ok(OutputType::stdout());
|
||||||
|
}
|
||||||
|
|
||||||
let is_less = pager_path.file_stem() == Some(&OsString::from("less"));
|
let is_less = pager_path.file_stem() == Some(&OsString::from("less"));
|
||||||
|
|
||||||
let mut process = if is_less {
|
let mut process = if is_less {
|
||||||
|
@ -415,6 +415,30 @@ fn pager_value_bat() {
|
|||||||
.failure();
|
.failure();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn pager_most() {
|
||||||
|
bat()
|
||||||
|
.env("PAGER", "most")
|
||||||
|
.arg("--paging=always")
|
||||||
|
.arg("test.txt")
|
||||||
|
.assert()
|
||||||
|
.success()
|
||||||
|
.stderr(predicate::eq("WARNING: Ignoring PAGER=\"most\": Coloring not supported. Override with BAT_PAGER=\"most\" or --pager \"most\"\n").normalize())
|
||||||
|
.stdout(predicate::eq("hello world\n").normalize());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn pager_most_with_arg() {
|
||||||
|
bat()
|
||||||
|
.env("PAGER", "most -w")
|
||||||
|
.arg("--paging=always")
|
||||||
|
.arg("test.txt")
|
||||||
|
.assert()
|
||||||
|
.success()
|
||||||
|
.stderr(predicate::eq("WARNING: Ignoring PAGER=\"most -w\": Coloring not supported. Override with BAT_PAGER=\"most -w\" or --pager \"most -w\"\n").normalize())
|
||||||
|
.stdout(predicate::eq("hello world\n").normalize());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn alias_pager_disable() {
|
fn alias_pager_disable() {
|
||||||
bat()
|
bat()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user