diff options
author | Thomas Otto <th1000s@posteo.net> | 2021-10-18 17:15:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-18 11:15:58 -0400 |
commit | 4f5e3ebbd1106c5f8e418b5743e2166576c9f0a8 (patch) | |
tree | f736e587dc494212e919fc3f22697d236a132827 /src/options/set.rs | |
parent | 3a03d4b5eede9a6c342a61941dd78c38c3559824 (diff) |
Use fatal() to exit with errorcode 2 (#739)
* Fix two typos
* Dismantle two Pyramids of Doom
Use question mark operator instead
* Use fatal() to exit with errorcode 2
Diffstat (limited to 'src/options/set.rs')
-rw-r--r-- | src/options/set.rs | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/options/set.rs b/src/options/set.rs index 18c10118..c8a700e2 100644 --- a/src/options/set.rs +++ b/src/options/set.rs @@ -1,6 +1,5 @@ use std::collections::{HashMap, HashSet, VecDeque}; use std::convert::TryInto; -use std::process; use std::result::Result; use std::str::FromStr; @@ -230,8 +229,7 @@ fn set__light__dark__syntax_theme__options( ) { let validate_light_and_dark = |opt: &cli::Opt| { if opt.light && opt.dark { - eprintln!("--light and --dark cannot be used together."); - process::exit(1); + fatal("--light and --dark cannot be used together."); } }; let empty_builtin_features = HashMap::new(); @@ -498,11 +496,10 @@ impl FromStr for cli::InspectRawLines { "true" => Ok(Self::True), "false" => Ok(Self::False), _ => { - eprintln!( + fatal(format!( r#"Invalid value for inspect-raw-lines option: {}. Valid values are "true", and "false"."#, s - ); - process::exit(1); + )); } } } @@ -514,11 +511,10 @@ fn parse_paging_mode(paging_mode_string: &str) -> PagingMode { "never" => PagingMode::Never, "auto" => PagingMode::QuitIfOneScreen, _ => { - eprintln!( + fatal(format!( "Invalid value for --paging option: {} (valid values are \"always\", \"never\", and \"auto\")", paging_mode_string - ); - process::exit(1); + )); } } } @@ -610,11 +606,10 @@ fn set_true_color(opt: &mut cli::Opt) { "never" => false, "auto" => is_truecolor_terminal(), _ => { - eprintln!( + fatal(format!( "Invalid value for --true-color option: {} (valid values are \"always\", \"never\", and \"auto\")", opt.true_color - ); - process::exit(1); + )); } }; } |