1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-03-13 22:28:26 +00:00

address comments

This commit is contained in:
rleungx 2018-05-11 19:39:43 +08:00
parent ad59045253
commit b69c70b408
2 changed files with 7 additions and 9 deletions

View File

@ -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),
)
})?)
}
}

View File

@ -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();