on master help sign in
PagerSource: [Bat]PagerEnvVar -> EnvVar[Bat]Pager
commitdfe7a601402b974b57f8f103fe5dfec69b69f14a authorMartin Nordholts <enselic@gmail.com> dateSun 10 Jan 2021, 13:16 (6 years ago) parentfc30277
2 files changed+7−7
src/output.rs+1−1 src/pager.rs+6−6
src/output.rs+1−1
@@ -73,7 +73,7 @@ impl OutputType {
7373 //
7474 // We only do this for PAGER (as it is not specific to 'bat'), not for BAT_PAGER
7575 // or bats '--pager' command line option.
76− let replace_arguments_to_less = pager.source == PagerSource::PagerEnvVar;
76+ let replace_arguments_to_less = pager.source == PagerSource::EnvVarPager;
7777
7878 if args.is_empty() || replace_arguments_to_less {
7979 p.arg("--RAW-CONTROL-CHARS");
src/pager.rs+6−6
@@ -8,10 +8,10 @@ pub(crate) enum PagerSource {
88 Config,
99
1010 /// From the env var BAT_PAGER
11− BatPagerEnvVar,
11+ EnvVarBatPager,
1212
1313 /// From the env var PAGER
14− PagerEnvVar,
14+ EnvVarPager,
1515
1616 /// No pager was specified, default is used
1717 Default,
@@ -93,8 +93,8 @@ pub(crate) fn get_pager(config_pager: Option<&str>) -> Result<Option<Pager>, Par
9393
9494 let (cmd, source) = match (config_pager, &bat_pager, &pager) {
9595 (Some(config_pager), _, _) => (config_pager, PagerSource::Config),
96− (_, Ok(bat_pager), _) => (bat_pager.as_str(), PagerSource::BatPagerEnvVar),
97− (_, _, Ok(pager)) => (pager.as_str(), PagerSource::PagerEnvVar),
96+ (_, Ok(bat_pager), _) => (bat_pager.as_str(), PagerSource::EnvVarBatPager),
97+ (_, _, Ok(pager)) => (pager.as_str(), PagerSource::EnvVarPager),
9898 _ => ("less", PagerSource::Default),
9999 };
100100
@@ -106,11 +106,11 @@ pub(crate) fn get_pager(config_pager: Option<&str>) -> Result<Option<Pager>, Par
106106 // 'more' and 'most' does not supports colors; automatically use 'less' instead
107107 // if the problematic pager came from the generic PAGER env var
108108 let no_color_support = kind == PagerKind::More || kind == PagerKind::Most;
109− let use_less_instead = no_color_support && source == PagerSource::PagerEnvVar;
109+ let use_less_instead = no_color_support && source == PagerSource::EnvVarPager;
110110
111111 Ok(Some(if use_less_instead {
112112 let no_args = vec![];
113− Pager::new("less", &no_args, PagerKind::Less, PagerSource::PagerEnvVar)
113+ Pager::new("less", &no_args, PagerKind::Less, PagerSource::EnvVarPager)
114114 } else {
115115 Pager::new(bin, args, kind, source)
116116 }))