Set up initial structure for the nix builder.
This commit is contained in:
36
src/main.rs
Normal file
36
src/main.rs
Normal file
@@ -0,0 +1,36 @@
|
||||
use std::process::ExitCode;
|
||||
|
||||
use clap::Parser;
|
||||
|
||||
use self::cli::parameters::Cli;
|
||||
use self::cli::parameters::Commands;
|
||||
use self::command::build::run_build;
|
||||
use self::command::daemon::start_daemon;
|
||||
use self::error::CustomError;
|
||||
use self::init_tracing::init_telemetry;
|
||||
use self::init_tracing::shutdown_telemetry;
|
||||
mod cli;
|
||||
mod command;
|
||||
mod config;
|
||||
mod error;
|
||||
mod init_tracing;
|
||||
|
||||
fn main() -> Result<ExitCode, CustomError> {
|
||||
let rt = tokio::runtime::Runtime::new()?;
|
||||
rt.block_on(async { main_body().await })
|
||||
}
|
||||
|
||||
async fn main_body() -> Result<ExitCode, CustomError> {
|
||||
init_telemetry().expect("Telemetry should initialize successfully.");
|
||||
let args = Cli::parse();
|
||||
match args.command {
|
||||
Commands::Build(args) => {
|
||||
run_build(args).await?;
|
||||
}
|
||||
Commands::Daemon(args) => {
|
||||
start_daemon(args).await?;
|
||||
}
|
||||
};
|
||||
shutdown_telemetry().expect("Telemetry should shutdown successfully.");
|
||||
Ok(ExitCode::SUCCESS)
|
||||
}
|
||||
Reference in New Issue
Block a user