summaryrefslogtreecommitdiffstats
path: root/src/color.rs
diff options
context:
space:
mode:
authorThomas Otto <th1000s@posteo.net>2021-10-18 17:15:58 +0200
committerGitHub <noreply@github.com>2021-10-18 11:15:58 -0400
commit4f5e3ebbd1106c5f8e418b5743e2166576c9f0a8 (patch)
treef736e587dc494212e919fc3f22697d236a132827 /src/color.rs
parent3a03d4b5eede9a6c342a61941dd78c38c3559824 (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/color.rs')
-rw-r--r--src/color.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/color.rs b/src/color.rs
index e7c3f62f..dfa86fa7 100644
--- a/src/color.rs
+++ b/src/color.rs
@@ -1,5 +1,4 @@
use std::collections::HashMap;
-use std::process;
use std::str::FromStr;
use ansi_term::Color;
@@ -7,6 +6,7 @@ use lazy_static::lazy_static;
use syntect::highlighting::Color as SyntectColor;
use crate::bat_utils::terminal::to_ansi_color;
+use crate::fatal;
use crate::syntect_utils;
pub fn parse_color(s: &str, true_color: bool) -> Option<Color> {
@@ -14,8 +14,7 @@ pub fn parse_color(s: &str, true_color: bool) -> Option<Color> {
return None;
}
let die = || {
- eprintln!("Invalid color or style attribute: {}", s);
- process::exit(1);
+ fatal(format!("Invalid color or style attribute: {}", s));
};
let syntect_color = if s.starts_with('#') {
SyntectColor::from_str(s).unwrap_or_else(|_| die())