use clap::crate_version;
use ebi;
use ebi::ebi_framework::ebi_command::EBI_COMMANDS;
use ebi_objects::anyhow::{Context, Result};
use env_logger::Builder;
use log::LevelFilter;

pub fn main() -> Result<()> {
    //enable debugging
    if cfg!(debug_assertions) {
        Builder::new().filter_level(LevelFilter::Trace).init();
    }

    let command = EBI_COMMANDS.build_cli();
    let command = command.version(crate_version!());
    let cli_matches = command.get_matches();

    log::info!("Ebi starting");

    EBI_COMMANDS.execute(&cli_matches).context("Executing Ebi")
}
