on master help sign in
Rename methods and parameters
commitacf51bd7b3fdec64b1e5fe77fa09260135dadcbd authorsharkdp <davidpeter@web.de> dateSat 21 Mar 2020, 20:36 (7 years ago) parent83dc13a
2 files changed+8−8
src/assets.rs+6−6 src/bin/bat/main.rs+2−2
src/assets.rs+6−6
@@ -23,13 +23,13 @@ impl HighlightingAssets {
2323 "Monokai Extended"
2424 }
2525
26− pub fn from_files(source_dir: &Path, start_empty: bool) -> Result<Self> {
27− let mut theme_set = if start_empty {
26+ pub fn from_files(source_dir: &Path, include_integrated_assets: bool) -> Result<Self> {
27+ let mut theme_set = if include_integrated_assets {
28+ Self::get_integrated_themeset()
29+ } else {
2830 ThemeSet {
2931 themes: BTreeMap::new(),
3032 }
31− } else {
32− Self::get_integrated_themeset()
3333 };
3434
3535 let theme_dir = source_dir.join("themes");
@@ -42,7 +42,7 @@ impl HighlightingAssets {
4242 );
4343 }
4444
45− let mut syntax_set_builder = if start_empty {
45+ let mut syntax_set_builder = if !include_integrated_assets {
4646 let mut builder = SyntaxSetBuilder::new();
4747 builder.add_plain_text_syntax();
4848 builder
@@ -112,7 +112,7 @@ impl HighlightingAssets {
112112 }
113113 }
114114
115− pub fn save(&self, target_dir: &Path) -> Result<()> {
115+ pub fn save_to_cache(&self, target_dir: &Path) -> Result<()> {
116116 let _ = fs::create_dir_all(target_dir);
117117 let theme_set_path = target_dir.join("themes.bin");
118118 let syntax_set_path = target_dir.join("syntaxes.bin");
src/bin/bat/main.rs+2−2
@@ -48,8 +48,8 @@ fn run_cache_subcommand(matches: &clap::ArgMatches) -> Result<()> {
4848
4949 let blank = matches.is_present("blank");
5050
51− let assets = HighlightingAssets::from_files(source_dir, blank)?;
52− assets.save(target_dir)?;
51+ let assets = HighlightingAssets::from_files(source_dir, !blank)?;
52+ assets.save_to_cache(target_dir)?;
5353 } else if matches.is_present("clear") {
5454 clear_assets();
5555 }