2023-12-21 17:18:51 -05:00
|
|
|
#![feature(let_chains)]
|
2024-10-18 21:05:29 -04:00
|
|
|
#![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;
|
2023-10-20 19:13:22 -04:00
|
|
|
use self::command::build::build_site;
|
2023-12-21 19:28:31 -05:00
|
|
|
use self::command::init::init_natter_folder;
|
2023-10-22 13:44:03 -04:00
|
|
|
use self::error::CustomError;
|
2023-10-18 19:47:05 -04:00
|
|
|
mod cli;
|
2023-10-18 19:54:18 -04:00
|
|
|
mod command;
|
2023-10-18 19:59:45 -04:00
|
|
|
mod config;
|
2023-10-27 13:05:34 -04:00
|
|
|
mod context;
|
2023-10-22 13:44:03 -04:00
|
|
|
mod error;
|
2023-10-27 13:05:34 -04:00
|
|
|
mod intermediate;
|
2023-10-22 16:26:43 -04:00
|
|
|
mod render;
|
2024-10-19 17:26:37 -04:00
|
|
|
mod walk_fs;
|
2023-10-18 19:47:05 -04:00
|
|
|
|
2023-10-22 13:44:03 -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
|
|
|
}
|
|
|
|
|
2023-10-22 13:44:03 -04:00
|
|
|
async fn main_body() -> Result<ExitCode, CustomError> {
|
2023-10-18 19:26:04 -04:00
|
|
|
let args = Cli::parse();
|
|
|
|
match args.command {
|
2023-10-18 20:21:28 -04:00
|
|
|
Commands::Init(args) => {
|
2023-12-21 19:28:31 -05:00
|
|
|
init_natter_folder(args).await?;
|
2023-10-20 19:13:22 -04:00
|
|
|
}
|
|
|
|
Commands::Build(args) => {
|
|
|
|
build_site(args).await?;
|
2023-10-18 20:21:28 -04:00
|
|
|
}
|
2023-10-18 19:26:04 -04:00
|
|
|
};
|
|
|
|
Ok(ExitCode::SUCCESS)
|
|
|
|
}
|