mirror of
https://github.com/sharkdp/bat.git
synced 2025-03-13 22:28:26 +00:00
address comments
This commit is contained in:
parent
ad59045253
commit
b69c70b408
@ -127,11 +127,12 @@ impl HighlightingAssets {
|
||||
}
|
||||
|
||||
pub fn get_theme(&self, theme: &str) -> Result<&Theme> {
|
||||
let err = format!("Could not find '{}' theme", theme);
|
||||
Ok(self.theme_set
|
||||
.themes
|
||||
.get(theme)
|
||||
.ok_or_else(|| io::Error::new(io::ErrorKind::Other, err))?)
|
||||
Ok(self.theme_set.themes.get(theme).ok_or_else(|| {
|
||||
io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
format!("Could not find '{}' theme", theme),
|
||||
)
|
||||
})?)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,10 +223,7 @@ fn run() -> Result<()> {
|
||||
let config = app.config()?;
|
||||
|
||||
let assets = HighlightingAssets::new();
|
||||
let theme = match config.theme {
|
||||
Some(t) => assets.get_theme(t)?,
|
||||
None => assets.get_theme("Default")?
|
||||
};
|
||||
let theme = assets.get_theme(config.theme.unwrap_or("Default"))?;
|
||||
|
||||
if app.matches.is_present("list-languages") {
|
||||
let languages = assets.syntax_set.syntaxes();
|
||||
|
Loading…
x
Reference in New Issue
Block a user