Rename "Config" to "CliConfig"
This commit is contained in:
parent
904d3fa8c0
commit
b98dea3946
4 changed files with 13 additions and 13 deletions
|
@ -13,14 +13,14 @@ impl ModuleConfig {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct Config<'a> {
|
||||
pub struct CliConfig<'a> {
|
||||
pub module_configs : Vec<ModuleConfig>,
|
||||
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(),
|
||||
}
|
||||
|
|
|
@ -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/"))
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue