2015-10-18 13:58:17 +00:00
|
|
|
extern crate clap;
|
|
|
|
use clap::{App, ArgMatches};
|
|
|
|
|
|
|
|
pub struct ModuleConfig {
|
2015-10-18 18:52:35 +00:00
|
|
|
pub load : bool,
|
2015-10-18 13:58:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl ModuleConfig {
|
|
|
|
pub fn new() -> ModuleConfig {
|
|
|
|
ModuleConfig {
|
|
|
|
load: false,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-25 18:47:17 +00:00
|
|
|
pub struct Config<'a> {
|
2015-10-18 18:52:35 +00:00
|
|
|
pub module_configs : Vec<ModuleConfig>,
|
2015-10-25 18:47:17 +00:00
|
|
|
pub cli_matches : ArgMatches<'a, 'a>,
|
2015-10-18 13:58:17 +00:00
|
|
|
}
|
|
|
|
|
2015-10-25 18:47:17 +00:00
|
|
|
impl<'a> Config<'a> {
|
|
|
|
pub fn new(app : clap::App<'a, 'a, 'a, 'a, 'a, 'a>) -> Config<'a> {
|
2015-10-18 13:58:17 +00:00
|
|
|
Config {
|
|
|
|
module_configs: vec![],
|
2015-10-25 18:47:17 +00:00
|
|
|
cli_matches: app.get_matches(),
|
2015-10-18 13:58:17 +00:00
|
|
|
}
|
|
|
|
}
|
2015-10-18 18:52:35 +00:00
|
|
|
|
|
|
|
pub fn is_verbose(&self) -> bool {
|
2015-10-25 18:47:17 +00:00
|
|
|
self.cli_matches.is_present("verbose")
|
2015-10-18 18:52:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn is_debugging(&self) -> bool {
|
2015-10-25 18:47:17 +00:00
|
|
|
self.cli_matches.is_present("debugging")
|
2015-10-18 13:58:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|