batmon 0.2.0

Interactive batteries viewer
#[macro_use]
extern crate log;

use std::sync::Arc;

use clap::Parser;

mod app;
mod errors;

pub use self::errors::{Error, Result};

fn main() -> Result<()> {
    let config = Arc::new(app::config::Config::parse());
    stderrlog::new()
        .module(module_path!())
        .verbosity(config.verbosity())
        .timestamp(stderrlog::Timestamp::Second)
        .init()?;

    trace!("Starting with {:?}", &config);
    let mut app = app::init(config)?;

    match app.run() {
        Err(Error::UserExit) => {
            trace!("Exit was requested by user, terminating");
            Ok(())
        }
        Ok(_) => Ok(()),
        Err(e) => {
            error!("Error occurred: {:?}", e);
            Err(e)
        }
    }
}