39 lines
884 B
Rust
39 lines
884 B
Rust
|
#![allow(dead_code)]
|
||
|
//#![allow(unused_imports)]
|
||
|
//#![allow(unused_variables)]
|
||
|
|
||
|
use anyhow::Result;
|
||
|
use clap::Parser;
|
||
|
use slog::{o, Drain};
|
||
|
|
||
|
mod commands;
|
||
|
|
||
|
#[tokio::main]
|
||
|
async fn main() {
|
||
|
let result = run().await;
|
||
|
|
||
|
match result {
|
||
|
Ok(exit_code) => std::process::exit(exit_code),
|
||
|
Err(msg) => {
|
||
|
log::error!("{:?}", msg);
|
||
|
std::process::exit(1);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
async fn run() -> Result<i32> {
|
||
|
// Set up logging.
|
||
|
let decorator = slog_term::TermDecorator::new().build();
|
||
|
let drain = slog_term::FullFormat::new(decorator).build().fuse();
|
||
|
let drain = std::sync::Mutex::new(drain).fuse();
|
||
|
|
||
|
let log = slog::Logger::root(drain, o!());
|
||
|
let _log_guard = slog_stdlog::init().unwrap();
|
||
|
|
||
|
// Parse the command and process everything.
|
||
|
let args = commands::RootCommand::parse();
|
||
|
args.run(log).await?;
|
||
|
|
||
|
Ok(0)
|
||
|
}
|