1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use core::str;
use yaml_rust::Yaml;
mod config_provider;
mod local_config;
pub mod profiles;
mod yaml;
pub use config_provider::ConfigProvider;
pub struct ReadConfigFilesCommand<'a, T: AsRef<str>> {
pub(crate) profiles: &'a [T],
pub(crate) config_dir: &'a str,
}
impl<'a, T: AsRef<str>> ReadConfigFilesCommand<'a, T> {
pub fn new(profiles: &'a [T], config_dir: &'a str) -> ReadConfigFilesCommand<'a, T> {
ReadConfigFilesCommand {
profiles,
config_dir,
}
}
}
pub fn read_yaml_config_from_files<'a, T: AsRef<str>>(
command: &ReadConfigFilesCommand<'a, T>,
) -> Yaml {
let lc = local_config::read_profiles_configs(command.profiles, command.config_dir);
yaml::parse_yaml_config(&lc)
}