diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-06-10 21:20:08 -0400 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2020-06-10 21:58:20 -0400 |
commit | ea91be31180d48b6d19870d3a5470552f9606357 (patch) | |
tree | 0b881c1c23b7dcc04fe24e2ede7e4d296f46c8ec /src/bat | |
parent | 11788656767aa6044ed71d212adf0dcde4c5e5d5 (diff) |
Refactor: Config::from_args
Diffstat (limited to 'src/bat')
-rw-r--r-- | src/bat/output.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/bat/output.rs b/src/bat/output.rs index d1f9636f..efb3fafa 100644 --- a/src/bat/output.rs +++ b/src/bat/output.rs @@ -10,7 +10,7 @@ use shell_words; use super::less::retrieve_less_version; -use crate::config::Config; +use crate::config; use crate::env; #[derive(Debug, Clone, Copy, PartialEq)] @@ -28,7 +28,11 @@ pub enum OutputType { } impl OutputType { - pub fn from_mode(mode: PagingMode, pager: Option<&str>, config: &Config) -> Result<Self> { + pub fn from_mode( + mode: PagingMode, + pager: Option<&str>, + config: &config::Config, + ) -> Result<Self> { use self::PagingMode::*; Ok(match mode { Always => OutputType::try_pager(false, pager, config)?, @@ -41,7 +45,7 @@ impl OutputType { fn try_pager( quit_if_one_screen: bool, pager_from_config: Option<&str>, - config: &Config, + config: &config::Config, ) -> Result<Self> { let mut replace_arguments_to_less = false; @@ -121,7 +125,7 @@ impl OutputType { p }; if config.navigate { - process.args(&["--pattern", &config.make_navigate_regexp()]); + process.args(&["--pattern", &config::make_navigate_regexp(&config)]); } Ok(process .env("LESSANSIENDCHARS", "mK") |