imag/src/main.rs

56 lines
1.5 KiB
Rust

#[macro_use] extern crate clap;
#[macro_use] extern crate log;
#[macro_use] extern crate serde;
#[macro_use] extern crate serde_json;
#[macro_use] extern crate glob;
#[macro_use] extern crate uuid;
#[macro_use] extern crate regex;
#[macro_use] extern crate prettytable;
extern crate pulldown_cmark;
extern crate url;
extern crate config;
extern crate open;
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;
pub use module::notes::Notes;
fn main() {
let yaml = load_yaml!("../etc/cli.yml");
let app = App::from_yaml(yaml);
let config = CliConfig::new(app);
ImagLogger::init(&config);
let configuration = Configuration::new(&config);
debug!("Logger created!");
debug!("CliConfig : {:?}", &config);
debug!("Configuration: {:?}", &configuration);
let rt = Runtime::new(configuration, config);
debug!("Runtime : {:?}", &rt);
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,
};
info!("Module execution ended with {}", res);
}