Addd flag to list used template variables

This commit is contained in:
2021-05-27 23:34:46 +02:00
parent 8d9937e44e
commit ce84eac3c3
4 changed files with 121 additions and 21 deletions

View File

@ -4,11 +4,13 @@ extern crate log;
mod builder;
mod error;
mod linker;
mod peeker;
use builder::build_tree;
use error::Errors;
use linker::link_tree;
use log::LevelFilter;
use peeker::peek_tree;
use std::env;
use std::path::PathBuf;
use structopt::StructOpt;
@ -24,6 +26,9 @@ struct Opt {
#[structopt(short, long)]
link_dir: Option<PathBuf>,
#[structopt(short, long)]
print_variables: bool,
#[structopt(short, parse(from_occurrences))]
verbosity: u8,
@ -75,11 +80,16 @@ async fn run() -> Result<(), Errors> {
flags: opt.flags,
};
info!("building tree");
build_tree(&cfg).await?;
if opt.print_variables {
info!("peeking tree");
peek_tree(&cfg).await?;
} else {
info!("building tree");
build_tree(&cfg).await?;
info!("linking tree");
link_tree(&cfg).await?;
info!("linking tree");
link_tree(&cfg).await?;
}
Ok(())
}