mirror of
https://github.com/sharkdp/bat
synced 2026-08-09 19:51:48 +00:00
Include syntaxes and themes in repository
This changes a few things: - All syntaxes and themes are now stored (as submodules) under assets/syntaxes and assets/themes - The default directories for syntaxes and themes are "syntaxes" and "themes" (used to be "syntax" and "themes") - The "bat cache" command can now take a `--source <dir>` and `--target <dir>` option. - The cached files have been renamed to "themes.bin" and "syntaxes.bin"
This commit is contained in:
+6
-2
@@ -27,6 +27,7 @@ mod terminal;
|
||||
|
||||
use std::fs::{self, File};
|
||||
use std::io::{self, BufRead, BufReader, Write};
|
||||
use std::path::Path;
|
||||
use std::process::{self, Child, Command, Stdio};
|
||||
|
||||
#[cfg(unix)]
|
||||
@@ -206,8 +207,11 @@ fn run() -> Result<()> {
|
||||
match app.matches.subcommand() {
|
||||
("cache", Some(cache_matches)) => {
|
||||
if cache_matches.is_present("init") {
|
||||
let assets = HighlightingAssets::from_files()?;
|
||||
assets.save()?;
|
||||
let source_dir = cache_matches.value_of("source").map(Path::new);
|
||||
let target_dir = cache_matches.value_of("target").map(Path::new);
|
||||
|
||||
let assets = HighlightingAssets::from_files(source_dir)?;
|
||||
assets.save(target_dir)?;
|
||||
} else if cache_matches.is_present("clear") {
|
||||
print!("Clearing theme set cache ... ");
|
||||
fs::remove_file(theme_set_path()).ok();
|
||||
|
||||
Reference in New Issue
Block a user