natter/src/main.rs

38 lines
838 B
Rust
Raw Normal View History

#![feature(let_chains)]
#![feature(async_closure)]
2023-10-18 19:26:04 -04:00
use std::process::ExitCode;
2023-10-18 19:47:05 -04:00
use clap::Parser;
use self::cli::parameters::Cli;
use self::cli::parameters::Commands;
use self::command::build::build_site;
2023-12-21 19:28:31 -05:00
use self::command::init::init_natter_folder;
use self::error::CustomError;
2023-10-18 19:47:05 -04:00
mod cli;
mod command;
mod config;
mod context;
mod error;
mod intermediate;
mod render;
2024-10-19 17:26:37 -04:00
mod walk_fs;
2023-10-18 19:47:05 -04:00
fn main() -> Result<ExitCode, CustomError> {
2023-10-18 19:26:04 -04:00
let rt = tokio::runtime::Runtime::new()?;
2023-12-23 06:38:23 -05:00
rt.block_on(async { main_body().await })
2023-10-18 19:26:04 -04:00
}
async fn main_body() -> Result<ExitCode, CustomError> {
2023-10-18 19:26:04 -04:00
let args = Cli::parse();
match args.command {
Commands::Init(args) => {
2023-12-21 19:28:31 -05:00
init_natter_folder(args).await?;
}
Commands::Build(args) => {
build_site(args).await?;
}
2023-10-18 19:26:04 -04:00
};
Ok(ExitCode::SUCCESS)
}