diff --git a/src/assets.rs b/src/assets.rs index 203ae39b..d1a89735 100644 --- a/src/assets.rs +++ b/src/assets.rs @@ -23,13 +23,13 @@ impl HighlightingAssets { "Monokai Extended" } - pub fn from_files(source_dir: &Path, start_empty: bool) -> Result { - let mut theme_set = if start_empty { + pub fn from_files(source_dir: &Path, include_integrated_assets: bool) -> Result { + let mut theme_set = if include_integrated_assets { + Self::get_integrated_themeset() + } else { ThemeSet { themes: BTreeMap::new(), } - } else { - Self::get_integrated_themeset() }; let theme_dir = source_dir.join("themes"); @@ -42,7 +42,7 @@ impl HighlightingAssets { ); } - let mut syntax_set_builder = if start_empty { + let mut syntax_set_builder = if !include_integrated_assets { let mut builder = SyntaxSetBuilder::new(); builder.add_plain_text_syntax(); builder @@ -112,7 +112,7 @@ impl HighlightingAssets { } } - pub fn save(&self, target_dir: &Path) -> Result<()> { + pub fn save_to_cache(&self, target_dir: &Path) -> Result<()> { let _ = fs::create_dir_all(target_dir); let theme_set_path = target_dir.join("themes.bin"); let syntax_set_path = target_dir.join("syntaxes.bin"); diff --git a/src/bin/bat/main.rs b/src/bin/bat/main.rs index 95654fe6..be9697e6 100644 --- a/src/bin/bat/main.rs +++ b/src/bin/bat/main.rs @@ -48,8 +48,8 @@ fn run_cache_subcommand(matches: &clap::ArgMatches) -> Result<()> { let blank = matches.is_present("blank"); - let assets = HighlightingAssets::from_files(source_dir, blank)?; - assets.save(target_dir)?; + let assets = HighlightingAssets::from_files(source_dir, !blank)?; + assets.save_to_cache(target_dir)?; } else if matches.is_present("clear") { clear_assets(); }