Set output in config

This commit is contained in:
Jake Howard 2017-07-19 19:54:10 +01:00
parent db2baf3fa0
commit 298df33274
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -1,6 +1,7 @@
use serde_yaml; use serde_yaml;
use serde_yaml::Value; use serde_yaml::Value;
use std::path::PathBuf; use std::path::PathBuf;
use std::collections::HashMap;
pub mod read; pub mod read;
pub mod validate; pub mod validate;
@ -8,13 +9,15 @@ pub mod consts;
#[derive(Debug, Serialize, Deserialize, Default)] #[derive(Debug, Serialize, Deserialize, Default)]
pub struct Config { pub struct Config {
input: Vec<PathBuf> input: Vec<PathBuf>,
output: HashMap<String, PathBuf>
} }
impl Config { impl Config {
fn new(raw: Value) -> Config { fn new(raw: Value) -> Config {
return Config { return Config {
input: read::get_input_files(&raw), input: read::get_input_files(&raw),
output: read::get_output_files(&raw),
..Default::default() ..Default::default()
}; };
} }
@ -25,6 +28,5 @@ pub fn get_config() -> Config {
let config_str = read::read(); let config_str = read::read();
let config_value: Value = serde_yaml::from_str(&config_str).unwrap(); let config_value: Value = serde_yaml::from_str(&config_str).unwrap();
validate::validate(&config_value).expect("Validation Error"); validate::validate(&config_value).expect("Validation Error");
read::get_output_files(&config_value);
return Config::new(config_value); return Config::new(config_value);
} }