1
0
mirror of https://github.com/sharkdp/bat synced 2026-08-05 19:11:42 +00:00

Always show a warning when theme is unknown

This commit is contained in:
sharkdp
2018-07-23 21:38:45 +02:00
committed by David Peter
parent c899849101
commit 28397b8f78
3 changed files with 17 additions and 27 deletions
+3 -11
View File
@@ -1,4 +1,3 @@
use assets::HighlightingAssets;
use atty::{self, Stream};
use clap::{App as ClapApp, AppSettings, Arg, ArgGroup, ArgMatches, SubCommand};
use console::Term;
@@ -287,15 +286,8 @@ impl App {
.matches
.value_of("theme")
.map(String::from)
.or_else(|| {
env::var("BAT_THEME").ok().and_then(|theme_name_env| {
if HighlightingAssets::new().theme_exists(&theme_name_env) {
Some(theme_name_env)
} else {
None
}
})
}),
.or_else(|| env::var("BAT_THEME").ok())
.unwrap_or(String::from("Default")),
line_range: transpose(self.matches.value_of("line-range").map(LineRange::from))?,
})
}
@@ -349,7 +341,7 @@ pub struct Config<'a> {
pub paging_mode: PagingMode,
pub term_width: usize,
pub files: Vec<Option<&'a str>>,
pub theme: Option<String>,
pub theme: String,
pub line_range: Option<LineRange>,
}