Set output in config
This commit is contained in:
parent
db2baf3fa0
commit
298df33274
1 changed files with 5 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
|||
use serde_yaml;
|
||||
use serde_yaml::Value;
|
||||
use std::path::PathBuf;
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub mod read;
|
||||
pub mod validate;
|
||||
|
@ -8,13 +9,15 @@ pub mod consts;
|
|||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Config {
|
||||
input: Vec<PathBuf>
|
||||
input: Vec<PathBuf>,
|
||||
output: HashMap<String, PathBuf>
|
||||
}
|
||||
|
||||
impl Config {
|
||||
fn new(raw: Value) -> Config {
|
||||
return Config {
|
||||
input: read::get_input_files(&raw),
|
||||
output: read::get_output_files(&raw),
|
||||
..Default::default()
|
||||
};
|
||||
}
|
||||
|
@ -25,6 +28,5 @@ pub fn get_config() -> Config {
|
|||
let config_str = read::read();
|
||||
let config_value: Value = serde_yaml::from_str(&config_str).unwrap();
|
||||
validate::validate(&config_value).expect("Validation Error");
|
||||
read::get_output_files(&config_value);
|
||||
return Config::new(config_value);
|
||||
}
|
||||
|
|
Reference in a new issue