summaryrefslogtreecommitdiffstats
path: root/src/options
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2020-07-15 10:47:32 -0400
committerDan Davison <dandavison7@gmail.com>2020-07-15 12:37:44 -0400
commita3598348ca0e7f7383d68b6e0513cf97038477a7 (patch)
tree43f149b8eb7b16a01e6c2e70b6fbe90c239349dd /src/options
parent2496092f47a22e7be6eb50c176a7fa8e30999075 (diff)
Parse paging_mode option value after setting it
Diffstat (limited to 'src/options')
-rw-r--r--src/options/set.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/options/set.rs b/src/options/set.rs
index 98de6eac..6928fc65 100644
--- a/src/options/set.rs
+++ b/src/options/set.rs
@@ -67,7 +67,6 @@ pub fn set_options(
}
}
- set_paging_mode(opt);
set_widths(opt);
// Set light, dark, and syntax-theme.
@@ -162,6 +161,8 @@ pub fn set_options(
arg_matches,
true
);
+
+ opt.computed.paging_mode = parse_paging_mode(&opt.paging_mode);
}
#[allow(non_snake_case)]
@@ -448,19 +449,19 @@ fn is_truecolor_terminal() -> bool {
.unwrap_or(false)
}
-fn set_paging_mode(opt: &mut cli::Opt) {
- opt.computed.paging_mode = match opt.paging_mode.as_ref() {
+fn parse_paging_mode(paging_mode_string: &str) -> PagingMode {
+ match paging_mode_string {
"always" => PagingMode::Always,
"never" => PagingMode::Never,
"auto" => PagingMode::QuitIfOneScreen,
_ => {
eprintln!(
"Invalid value for --paging option: {} (valid values are \"always\", \"never\", and \"auto\")",
- opt.paging_mode
+ paging_mode_string
);
process::exit(1);
}
- };
+ }
}
fn set_widths(opt: &mut cli::Opt) {