ysv/
lib.rs

1pub use crate::compile::parse_config_from_file;
2use crate::options::{determine_variables, Options};
3pub use crate::options::LogFormat;
4use crate::worker::process;
5
6mod worker;
7mod options;
8mod compile;
9mod transform;
10mod writer;
11
12/// Configure the logger which will print log to stderr.
13/// Well, it is currently no-op
14fn configure_logging(_log_format: LogFormat) -> () {
15    simple_logger::init().unwrap();
16}
17
18
19/// Run ysv from command line.
20pub fn run(
21    log_format: LogFormat,
22    config_file_path: &str,
23    input_files: Option<Vec<String>>,
24) -> Result<(), String> {
25    let config = parse_config_from_file(config_file_path)?;
26    let variables = determine_variables();
27
28    // A little dirty side-effect: set logging format
29    configure_logging(log_format);
30
31    process(Options { config, variables, input_files })
32}