diff options
author | Canop <cano.petrole@gmail.com> | 2021-01-14 18:04:31 +0100 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2021-01-14 18:04:31 +0100 |
commit | 30ac7feca383f576ce075bcec505fccd7757f873 (patch) | |
tree | 58278c2b80fd05bb9d608e44f8460a462482516f | |
parent | d0d4596efe128b895336f0f7c4348022f639494e (diff) |
default configuration file made available in website and release
-rw-r--r-- | build.rs | 26 | ||||
-rwxr-xr-x | compile-all-targets.sh | 6 | ||||
-rw-r--r-- | website/docs/conf_file.md | 2 |
3 files changed, 32 insertions, 2 deletions
@@ -3,12 +3,20 @@ use { clap::Shell, - std::{env, str::FromStr}, + std::{ + env, + fs, + str::FromStr, + path::Path, + }, }; include!("src/clap.rs"); +include!("src/conf/default_conf.rs"); -fn main() { +/// write the shell completion scripts which will be added to +/// the release archive +fn build_completion_scripts() { // out_dir should be defined, see // https://doc.rust-lang.org/cargo/reference/environment-variables.html let out_dir = env::var_os("OUT_DIR").expect("out dir not set"); @@ -20,3 +28,17 @@ fn main() { } println!("completion scripts generated in {:?}", out_dir); } + +/// write the default configuration file, which will be added to +/// the release archive +fn build_default_conf() { + let out_dir = env::var_os("OUT_DIR").expect("out dir not set"); + let file_path = Path::new(&out_dir).join("default-conf.hjson"); + fs::write(&file_path, DEFAULT_CONF_FILE).expect("it to work :'("); + println!("default conf written in {:?}", file_path); +} + +fn main() { + build_completion_scripts(); + build_default_conf(); +} diff --git a/compile-all-targets.sh b/compile-all-targets.sh index 3e095a1..9dfbcc9 100755 --- a/compile-all-targets.sh +++ b/compile-all-targets.sh @@ -32,6 +32,12 @@ mkdir build/completion cp "$(broot -c ":gi;release;:focus;broot.bash;:parent;:pp" target)/"* build/completion echo " Done" +# find and copy the default conf +# (it's built as part of the normal compilation so must come after the linux version) +echo -e "${H2}copying default configuration${EH}" +cp "$(broot -c ":gi;release;:focus;deault-conf.hjson;:pp" target)" build +echo " Done" + # add the resource (the icons font) echo -e "${H2}copying resources${EH}" mkdir build/resources diff --git a/website/docs/conf_file.md b/website/docs/conf_file.md index 47ae296..b3b605c 100644 --- a/website/docs/conf_file.md +++ b/website/docs/conf_file.md @@ -11,6 +11,8 @@ From this screen you can directly open the configuration file in your system's e The default configuration file contains several example sections that you may uncomment and modify for your goals. +The current default configuration file may be seen here: [default-conf.hjson](https://dystroy.org/broot/download/default-conf.hjson). + # Default flags Broot accepts a few flags at launch (the complete list is available with `broot --help`. |