imag/src/main.rs

55 lines
1.3 KiB
Rust
Raw Normal View History

2015-10-18 13:58:17 +00:00
#[macro_use] extern crate clap;
2015-10-26 19:53:12 +00:00
#[macro_use] extern crate log;
2015-11-09 17:33:44 +00:00
#[macro_use] extern crate serde;
2015-11-08 16:32:43 +00:00
#[macro_use] extern crate serde_json;
2015-11-20 14:33:40 +00:00
#[macro_use] extern crate glob;
#[macro_use] extern crate uuid;
2015-10-25 18:56:04 +00:00
#[macro_use] extern crate regex;
#[macro_use] extern crate prettytable;
extern crate url;
2015-10-26 22:51:44 +00:00
extern crate config;
2015-10-18 13:58:17 +00:00
use std::process::exit;
2015-10-26 23:02:42 +00:00
use cli::CliConfig;
2015-10-26 22:51:44 +00:00
use configuration::Configuration;
2015-10-26 19:53:12 +00:00
use runtime::{ImagLogger, Runtime};
2015-10-25 18:47:17 +00:00
use clap::App;
2015-10-25 18:56:04 +00:00
use module::Module;
2015-10-18 13:58:17 +00:00
mod cli;
2015-10-26 22:51:44 +00:00
mod configuration;
2015-10-18 18:52:52 +00:00
mod runtime;
2015-10-24 15:46:01 +00:00
mod module;
2015-10-18 19:59:17 +00:00
mod storage;
2015-11-30 17:41:42 +00:00
mod ui;
2015-12-28 17:46:36 +00:00
mod util;
2015-10-18 13:58:17 +00:00
2015-12-20 15:32:18 +00:00
use module::bm::BM;
2015-10-18 13:58:17 +00:00
fn main() {
2015-10-25 18:47:17 +00:00
let yaml = load_yaml!("../etc/cli.yml");
let app = App::from_yaml(yaml);
let config = CliConfig::new(app);
2015-10-26 21:30:15 +00:00
let configuration = Configuration::new(&config);
2015-10-18 18:52:52 +00:00
2015-10-26 22:59:24 +00:00
let logger = ImagLogger::init(&configuration, &config);
2015-10-26 20:26:55 +00:00
debug!("Logger created!");
2015-11-27 18:24:58 +00:00
debug!("CliConfig : {:?}", &config);
debug!("Configuration: {:?}", &configuration);
let rt = Runtime::new(configuration, config);
2015-11-27 18:24:58 +00:00
debug!("Runtime : {:?}", &rt);
2015-10-18 18:52:52 +00:00
2015-10-25 18:56:04 +00:00
if let Some(matches) = rt.config.cli_matches.subcommand_matches("bm") {
2015-12-28 10:17:04 +00:00
let res = BM::new(&rt).exec(matches);
2015-12-20 11:43:57 +00:00
info!("BM exited with {}", res);
2015-10-25 18:56:04 +00:00
} else {
info!("No commandline call...")
}
info!("Hello, world!");
2015-10-18 13:58:17 +00:00
}