summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsharkdp <davidpeter@web.de>2019-02-07 22:37:12 +0100
committerDavid Peter <sharkdp@users.noreply.github.com>2019-02-07 23:27:53 +0100
commite09499b3df6369e1a1f6e42f95ad4009fa76c00e (patch)
tree2da125ac00642959d5bd0c3893c80cab5748b92e
parentcff01d81fa21e7ae469b9b4b2ea21e4578870732 (diff)
Move config-dir and cache-dir from 'bat cache' to 'bat'v0.10.0
-rw-r--r--README.md8
-rw-r--r--doc/README-ja.md8
-rw-r--r--src/clap_app.rs25
-rw-r--r--src/main.rs10
4 files changed, 27 insertions, 24 deletions
diff --git a/README.md b/README.md
index cd09a0c4..f4f723f3 100644
--- a/README.md
+++ b/README.md
@@ -270,8 +270,8 @@ and theme. To add new syntax definitions, do the following.
Create a folder with syntax definition files:
```bash
-mkdir -p "$(bat cache --config-dir)/syntaxes"
-cd "$(bat cache --config-dir)/syntaxes"
+mkdir -p "$(bat --config-dir)/syntaxes"
+cd "$(bat --config-dir)/syntaxes"
# Put new '.sublime-syntax' language definition files
# in this folder (or its subdirectories), for example:
@@ -298,8 +298,8 @@ This works very similar to how we add new syntax definitions.
First, create a folder with the new syntax highlighting themes:
```bash
-mkdir -p "$(bat cache --config-dir)/themes"
-cd "$(bat cache --config-dir)/themes"
+mkdir -p "$(bat --config-dir)/themes"
+cd "$(bat --config-dir)/themes"
# Download a theme in '.tmTheme' format, for example:
git clone https://github.com/greggb/sublime-snazzy
diff --git a/doc/README-ja.md b/doc/README-ja.md
index afac532b..b4b5ccba 100644
--- a/doc/README-ja.md
+++ b/doc/README-ja.md
@@ -263,8 +263,8 @@ bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
構文定義ファイルを入れておくためのフォルダを作る:
```bash
-mkdir -p "$(bat cache --config-dir)/syntaxes"
-cd "$(bat cache --config-dir)/syntaxes"
+mkdir -p "$(bat --config-dir)/syntaxes"
+cd "$(bat --config-dir)/syntaxes"
# Put new '.sublime-syntax' language definition files
# in this folder (or its subdirectories), for example:
@@ -290,8 +290,8 @@ bat cache --clear
まず、新しいシンタックスハイライトのテーマのフォルダを作ります:
```bash
-mkdir -p "$(bat cache --config-dir)/themes"
-cd "$(bat cache --config-dir)/themes"
+mkdir -p "$(bat --config-dir)/themes"
+cd "$(bat --config-dir)/themes"
# Download a theme in '.tmTheme' format, for example:
git clone https://github.com/greggb/sublime-snazzy
diff --git a/src/clap_app.rs b/src/clap_app.rs
index ba62747d..1c78673a 100644
--- a/src/clap_app.rs
+++ b/src/clap_app.rs
@@ -349,6 +349,18 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
.hidden(true)
.help("Show path to the configuration file."),
)
+ .arg(
+ Arg::with_name("config-dir")
+ .long("config-dir")
+ .hidden(true)
+ .help("Show bat's configuration directory."),
+ )
+ .arg(
+ Arg::with_name("cache-dir")
+ .long("cache-dir")
+ .hidden(true)
+ .help("Show bat's cache directory."),
+ )
.subcommand(
SubCommand::with_name("cache")
.about("Modify the syntax-definition and theme cache")
@@ -368,20 +380,9 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
.short("c")
.help("Remove the cached syntax definitions and themes."),
)
- .arg(
- Arg::with_name("config-dir")
- .long("config-dir")
- .short("d")
- .help("Show bat's configuration directory."),
- )
- .arg(
- Arg::with_name("cache-dir")
- .long("cache-dir")
- .help("Show bat's cache directory."),
- )
.group(
ArgGroup::with_name("cache-actions")
- .args(&["build", "clear", "config-dir", "cache-dir"])
+ .args(&["build", "clear"])
.required(arg_group_required),
)
.arg(
diff --git a/src/main.rs b/src/main.rs
index 98bd9b34..ed8f2239 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -96,10 +96,6 @@ fn run_cache_subcommand(matches: &clap::ArgMatches) -> Result<()> {
assets.save(target_dir)?;
} else if matches.is_present("clear") {
clear_assets();
- } else if matches.is_present("config-dir") {
- writeln!(io::stdout(), "{}", config_dir())?;
- } else if matches.is_present("cache-dir") {
- writeln!(io::stdout(), "{}", cache_dir())?;
}
Ok(())
@@ -235,6 +231,12 @@ fn run() -> Result<bool> {
println!("{}", config_file().to_string_lossy());
Ok(true)
+ } else if app.matches.is_present("config-dir") {
+ writeln!(io::stdout(), "{}", config_dir())?;
+ Ok(true)
+ } else if app.matches.is_present("cache-dir") {
+ writeln!(io::stdout(), "{}", cache_dir())?;
+ Ok(true)
} else {
run_controller(&config)
}