Rename methods and parameters

This commit is contained in:
sharkdp 2020-03-21 20:36:00 +01:00 committed by David Peter
parent 83dc13a86d
commit acf51bd7b3
2 changed files with 8 additions and 8 deletions

View File

@ -23,13 +23,13 @@ impl HighlightingAssets {
"Monokai Extended" "Monokai Extended"
} }
pub fn from_files(source_dir: &Path, start_empty: bool) -> Result<Self> { pub fn from_files(source_dir: &Path, include_integrated_assets: bool) -> Result<Self> {
let mut theme_set = if start_empty { let mut theme_set = if include_integrated_assets {
Self::get_integrated_themeset()
} else {
ThemeSet { ThemeSet {
themes: BTreeMap::new(), themes: BTreeMap::new(),
} }
} else {
Self::get_integrated_themeset()
}; };
let theme_dir = source_dir.join("themes"); 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(); let mut builder = SyntaxSetBuilder::new();
builder.add_plain_text_syntax(); builder.add_plain_text_syntax();
builder 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 _ = fs::create_dir_all(target_dir);
let theme_set_path = target_dir.join("themes.bin"); let theme_set_path = target_dir.join("themes.bin");
let syntax_set_path = target_dir.join("syntaxes.bin"); let syntax_set_path = target_dir.join("syntaxes.bin");

View File

@ -48,8 +48,8 @@ fn run_cache_subcommand(matches: &clap::ArgMatches) -> Result<()> {
let blank = matches.is_present("blank"); let blank = matches.is_present("blank");
let assets = HighlightingAssets::from_files(source_dir, blank)?; let assets = HighlightingAssets::from_files(source_dir, !blank)?;
assets.save(target_dir)?; assets.save_to_cache(target_dir)?;
} else if matches.is_present("clear") { } else if matches.is_present("clear") {
clear_assets(); clear_assets();
} }