imag/src/main.rs

61 lines
1.6 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;
2016-01-03 14:41:04 +00:00
extern crate hoedown;
extern crate url;
2015-10-26 22:51:44 +00:00
extern crate config;
2016-01-02 15:03:01 +00:00
extern crate open;
2016-01-03 14:21:25 +00:00
extern crate itertools;
2016-01-03 19:12:08 +00:00
extern crate ansi_term;
2016-01-03 15:59:31 +00:00
extern crate rand;
2015-10-18 13:58:17 +00:00
pub use cli::CliConfig;
pub use configuration::Configuration;
pub use runtime::{ImagLogger, Runtime};
pub use clap::App;
pub use module::Module;
pub mod cli;
pub mod configuration;
pub mod runtime;
pub mod module;
pub mod storage;
pub mod ui;
pub mod util;
pub use module::bm::BM;
2016-01-02 18:14:29 +00:00
pub use module::notes::Notes;
2015-12-20 15:32:18 +00:00
2015-10-18 13:58:17 +00:00
fn main() {
2016-01-03 19:28:42 +00:00
use ansi_term::Colour::Yellow;
2015-12-30 17:50:09 +00:00
let yaml = load_yaml!("../etc/cli.yml");
let app = App::from_yaml(yaml);
let config = CliConfig::new(app);
ImagLogger::init(&config);
2015-10-26 21:30:15 +00:00
let configuration = Configuration::new(&config);
2015-10-18 18:52:52 +00:00
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
2016-01-02 18:14:29 +00:00
let res = match rt.config.cli_matches.subcommand_name() {
Some("bm") => BM::new(&rt).exec(rt.config.cli_matches.subcommand_matches("bm").unwrap()),
Some("notes") => Notes::new(&rt).exec(rt.config.cli_matches.subcommand_matches("notes").unwrap()),
_ => false,
};
2016-01-03 19:28:42 +00:00
info!("{}", Yellow.paint(format!("Module execution ended with {}", res)));
2015-10-18 13:58:17 +00:00
}