natter/src/main.rs
2025-02-22 21:12:33 -05:00

42 lines
1.0 KiB
Rust

#![feature(let_chains)]
use std::process::ExitCode;
use clap::Parser;
use self::cli::parameters::Cli;
use self::cli::parameters::Commands;
use self::command::build::build_site;
use self::command::init::init_natter_folder;
use self::error::CustomError;
use self::init_tracing::init_telemetry;
use self::init_tracing::shutdown_telemetry;
mod cli;
mod command;
mod config;
mod context;
mod error;
mod init_tracing;
mod intermediate;
mod render;
mod walk_fs;
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::Init(args) => {
init_natter_folder(args).await?;
}
Commands::Build(args) => {
build_site(args).await?;
}
};
shutdown_telemetry().expect("Telemetry should shutdown successfully.");
Ok(ExitCode::SUCCESS)
}