diff options
author | rusty <rusty@spoqa.com> | 2021-06-08 19:20:57 +0900 |
---|---|---|
committer | rusty <rusty@spoqa.com> | 2021-06-08 19:47:21 +0900 |
commit | a0904c7dd6d57454804188da4b9905c9404f76fb (patch) | |
tree | 49544fb8f1c32447b5e60cf9269d6a743291bf9c | |
parent | fd3e2c35d80aa906aac0a4b36b4450e888b73647 (diff) |
Use config.pager for output
-rw-r--r-- | src/bat_utils/output.rs | 6 | ||||
-rw-r--r-- | src/main.rs | 3 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/bat_utils/output.rs b/src/bat_utils/output.rs index 388bc0c9..1166b4e2 100644 --- a/src/bat_utils/output.rs +++ b/src/bat_utils/output.rs @@ -29,7 +29,7 @@ pub enum OutputType { impl OutputType { pub fn from_mode( mode: PagingMode, - pager: Option<&str>, + pager: Option<String>, config: &config::Config, ) -> Result<Self> { use self::PagingMode::*; @@ -43,7 +43,7 @@ impl OutputType { /// Try to launch the pager. Fall back to stdout in case of errors. fn try_pager( quit_if_one_screen: bool, - pager_from_config: Option<&str>, + pager_from_config: Option<String>, config: &config::Config, ) -> Result<Self> { let mut replace_arguments_to_less = false; @@ -66,8 +66,6 @@ impl OutputType { _ => None, }; - let pager_from_config = pager_from_config.map(|p| p.to_string()); - if pager_from_config.is_some() { replace_arguments_to_less = false; } diff --git a/src/main.rs b/src/main.rs index 6cd878f4..d6ed0aa2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -82,7 +82,8 @@ fn run_app() -> std::io::Result<i32> { return Ok(0); } - let mut output_type = OutputType::from_mode(config.paging_mode, None, &config).unwrap(); + let mut output_type = + OutputType::from_mode(config.paging_mode, config.pager.clone(), &config).unwrap(); let mut writer = output_type.handle().unwrap(); if atty::is(atty::Stream::Stdin) { |