on master help sign in
Avoid endless bat executions with PAGER="bat"

From issue #383

commit8a0c30b385151698311b683c4c065f5042c5021f authorRodrigo Orem <8618619+rodorgas@users.noreply.github.com> dateWed 31 Oct 2018, 20:22 (8 years ago) parentbc21c4d
1 file changed+6−1
src/output.rs+6−1
src/output.rs+6−1
@@ -27,11 +27,16 @@ impl OutputType {
2727 /// Try to launch the pager. Fall back to stdout in case of errors.
2828 fn try_pager(quit_if_one_screen: bool, pager_from_config: Option<&str>) -> Result<Self> {
2929 let pager_from_env = env::var("BAT_PAGER").or_else(|_| env::var("PAGER"));
30− let pager = pager_from_config
30+
31+ let mut pager = pager_from_config
3132 .map(|p| p.to_string())
3233 .or(pager_from_env.ok())
3334 .unwrap_or(String::from("less"));
3435
36+ if pager == "bat" {
37+ pager = String::from("less");
38+ }
39+
3540 let pagerflags = shell_words::split(&pager)
3641 .chain_err(|| "Could not parse (BAT_)PAGER environment variable.")?;
3742