on master help sign in
Move config-dir and cache-dir from 'bat cache' to 'bat'
commite09499b3df6369e1a1f6e42f95ad4009fa76c00e authorsharkdp <davidpeter@web.de> dateThu 7 Feb 2019, 22:37 (8 years ago) parentcff01d8
4 files changed+27−24
README.md+4−4 doc/README-ja.md+4−4 src/clap_app.rs+13−12 src/main.rs+6−4
README.md+4−4
@@ -270,8 +270,8 @@ and theme. To add new syntax definitions, do the following.
270270Create a folder with syntax definition files:
271271
272272```bash
273−mkdir -p "$(bat cache --config-dir)/syntaxes"
274−cd "$(bat cache --config-dir)/syntaxes"
273+mkdir -p "$(bat --config-dir)/syntaxes"
274+cd "$(bat --config-dir)/syntaxes"
275275
276276# Put new '.sublime-syntax' language definition files
277277# in this folder (or its subdirectories), for example:
@@ -298,8 +298,8 @@ This works very similar to how we add new syntax definitions.
298298
299299First, create a folder with the new syntax highlighting themes:
300300```bash
301−mkdir -p "$(bat cache --config-dir)/themes"
302−cd "$(bat cache --config-dir)/themes"
301+mkdir -p "$(bat --config-dir)/themes"
302+cd "$(bat --config-dir)/themes"
303303
304304# Download a theme in '.tmTheme' format, for example:
305305git clone https://github.com/greggb/sublime-snazzy
doc/README-ja.md+4−4
@@ -263,8 +263,8 @@ bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
263263構文定義ファイルを入れておくためのフォルダを作る:
264264
265265```bash
266−mkdir -p "$(bat cache --config-dir)/syntaxes"
267−cd "$(bat cache --config-dir)/syntaxes"
266+mkdir -p "$(bat --config-dir)/syntaxes"
267+cd "$(bat --config-dir)/syntaxes"
268268
269269# Put new '.sublime-syntax' language definition files
270270# in this folder (or its subdirectories), for example:
@@ -290,8 +290,8 @@ bat cache --clear
290290
291291まず、新しいシンタックスハイライトのテーマのフォルダを作ります:
292292```bash
293−mkdir -p "$(bat cache --config-dir)/themes"
294−cd "$(bat cache --config-dir)/themes"
293+mkdir -p "$(bat --config-dir)/themes"
294+cd "$(bat --config-dir)/themes"
295295
296296# Download a theme in '.tmTheme' format, for example:
297297git clone https://github.com/greggb/sublime-snazzy
src/clap_app.rs+13−12
@@ -349,6 +349,18 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
349349 .hidden(true)
350350 .help("Show path to the configuration file."),
351351 )
352+ .arg(
353+ Arg::with_name("config-dir")
354+ .long("config-dir")
355+ .hidden(true)
356+ .help("Show bat's configuration directory."),
357+ )
358+ .arg(
359+ Arg::with_name("cache-dir")
360+ .long("cache-dir")
361+ .hidden(true)
362+ .help("Show bat's cache directory."),
363+ )
352364 .subcommand(
353365 SubCommand::with_name("cache")
354366 .about("Modify the syntax-definition and theme cache")
@@ -368,20 +380,9 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
368380 .short("c")
369381 .help("Remove the cached syntax definitions and themes."),
370382 )
371− .arg(
372− Arg::with_name("config-dir")
373− .long("config-dir")
374− .short("d")
375− .help("Show bat's configuration directory."),
376− )
377− .arg(
378− Arg::with_name("cache-dir")
379− .long("cache-dir")
380− .help("Show bat's cache directory."),
381− )
382383 .group(
383384 ArgGroup::with_name("cache-actions")
384− .args(&["build", "clear", "config-dir", "cache-dir"])
385+ .args(&["build", "clear"])
385386 .required(arg_group_required),
386387 )
387388 .arg(
src/main.rs+6−4
@@ -96,10 +96,6 @@ fn run_cache_subcommand(matches: &clap::ArgMatches) -> Result<()> {
9696 assets.save(target_dir)?;
9797 } else if matches.is_present("clear") {
9898 clear_assets();
99− } else if matches.is_present("config-dir") {
100− writeln!(io::stdout(), "{}", config_dir())?;
101− } else if matches.is_present("cache-dir") {
102− writeln!(io::stdout(), "{}", cache_dir())?;
10399 }
104100
105101 Ok(())
@@ -234,6 +230,12 @@ fn run() -> Result<bool> {
234230 } else if app.matches.is_present("config-file") {
235231 println!("{}", config_file().to_string_lossy());
236232
233+ Ok(true)
234+ } else if app.matches.is_present("config-dir") {
235+ writeln!(io::stdout(), "{}", config_dir())?;
236+ Ok(true)
237+ } else if app.matches.is_present("cache-dir") {
238+ writeln!(io::stdout(), "{}", cache_dir())?;
237239 Ok(true)
238240 } else {
239241 run_controller(&config)