Load templating variables from file

This commit is contained in:
2021-11-14 20:26:51 +01:00
parent 7cc798fcab
commit 61676bc6ee
5 changed files with 50 additions and 2 deletions

View File

@ -26,6 +26,9 @@ struct Opt {
#[structopt(short, long)]
link_dir: Option<PathBuf>,
#[structopt(long = "variables")]
variables_path: Option<PathBuf>,
#[structopt(short, long)]
print_variables: bool,
@ -40,6 +43,7 @@ pub struct Config {
template_dir: PathBuf,
build_dir: PathBuf,
link_dir: PathBuf,
variables_path: PathBuf,
flags: Vec<String>,
}
@ -77,6 +81,9 @@ async fn run() -> Result<(), Errors> {
link_dir: opt
.link_dir
.unwrap_or_else(|| env::var("HOME").expect("$HOME").into()),
variables_path: opt
.variables_path
.unwrap_or_else(|| xdg_dirs.get_config_file("variables.toml")),
flags: opt.flags,
};