diff --git a/src/cli.rs b/src/cli.rs index bf0528a3..7d148456 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -13,14 +13,14 @@ impl ModuleConfig { } } -pub struct Config<'a> { +pub struct CliConfig<'a> { pub module_configs : Vec, pub cli_matches : ArgMatches<'a, 'a>, } -impl<'a> Config<'a> { - pub fn new(app : clap::App<'a, 'a, 'a, 'a, 'a, 'a>) -> Config<'a> { - Config { +impl<'a> CliConfig<'a> { + pub fn new(app : clap::App<'a, 'a, 'a, 'a, 'a, 'a>) -> CliConfig<'a> { + CliConfig { module_configs: vec![], cli_matches: app.get_matches(), } diff --git a/src/configuration.rs b/src/configuration.rs index 17daa91f..d6d6643b 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -1,6 +1,6 @@ extern crate clap; -use cli::Config; +use cli::CliConfig; use std::path::Path; use clap::{App, ArgMatches}; @@ -18,7 +18,7 @@ pub struct Configuration { impl Configuration { - pub fn new(config: &Config) -> Configuration { + pub fn new(config: &CliConfig) -> Configuration { let rtp = rtp_path(config); let mut verbose = false; @@ -59,7 +59,7 @@ impl Configuration { } -fn rtp_path(config: &Config) -> String { +fn rtp_path(config: &CliConfig) -> String { String::from(config.cli_matches.value_of("rtp").unwrap_or("~/.imag/store/")) } diff --git a/src/main.rs b/src/main.rs index ffce2d4a..704e1c14 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,7 @@ #[macro_use] extern crate log; extern crate config; -use cli::Config; +use cli::CliConfig; use configuration::Configuration; use runtime::{ImagLogger, Runtime}; use clap::App; @@ -17,7 +17,7 @@ fn main() { let early_logger = ImagLogger::early().unwrap(); let yaml = load_yaml!("../etc/cli.yml"); let app = App::from_yaml(yaml); - let mut config = Config::new(app); + let mut config = CliConfig::new(app); let configuration = Configuration::new(&config); let logger = ImagLogger::init(&configuration, &config); diff --git a/src/runtime.rs b/src/runtime.rs index f781181a..25e61edc 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -1,6 +1,6 @@ extern crate log; -pub use cli::Config; +pub use cli::CliConfig; pub use configuration::Configuration as Cfg; use std::io::stderr; @@ -23,7 +23,7 @@ impl ImagLogger { ImagLogger::init_logger(LogLevelFilter::Error) } - pub fn init(cfg: &Cfg, config: &Config) -> Result<(), SetLoggerError> { + pub fn init(cfg: &Cfg, config: &CliConfig) -> Result<(), SetLoggerError> { if config.is_debugging() || cfg.is_debugging() { ImagLogger::init_logger(LogLevelFilter::Debug) } else if config.is_verbose() || cfg.is_debugging() { @@ -58,13 +58,13 @@ impl log::Log for ImagLogger { } pub struct Runtime<'a> { - pub config : Config<'a>, + pub config : CliConfig<'a>, pub configuration : Cfg, } impl<'a> Runtime<'a> { - pub fn new(cfg: Cfg, config : Config<'a>) -> Runtime<'a> { + pub fn new(cfg: Cfg, config : CliConfig<'a>) -> Runtime<'a> { Runtime { config: config, configuration: cfg,