Load templating variables from file
This commit is contained in:
@ -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,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user