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 /build.rs | |
parent | d0d4596efe128b895336f0f7c4348022f639494e (diff) |
default configuration file made available in website and release
Diffstat (limited to 'build.rs')
-rw-r--r-- | build.rs | 26 |
1 files changed, 24 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(); +} |