2023-12-21 22:18:51 +00:00
|
|
|
#![feature(let_chains)]
|
2023-10-18 23:26:04 +00:00
|
|
|
use std::process::ExitCode;
|
|
|
|
|
2023-10-18 23:47:05 +00:00
|
|
|
use clap::Parser;
|
|
|
|
|
|
|
|
use self::cli::parameters::Cli;
|
|
|
|
use self::cli::parameters::Commands;
|
2023-10-20 23:13:22 +00:00
|
|
|
use self::command::build::build_site;
|
2023-12-22 00:28:31 +00:00
|
|
|
use self::command::init::init_natter_folder;
|
2023-10-22 17:44:03 +00:00
|
|
|
use self::error::CustomError;
|
2023-10-18 23:47:05 +00:00
|
|
|
mod cli;
|
2023-10-18 23:54:18 +00:00
|
|
|
mod command;
|
2023-10-18 23:59:45 +00:00
|
|
|
mod config;
|
2023-10-27 17:05:34 +00:00
|
|
|
mod context;
|
2023-10-22 17:44:03 +00:00
|
|
|
mod error;
|
2023-10-27 17:05:34 +00:00
|
|
|
mod intermediate;
|
2023-10-22 20:26:43 +00:00
|
|
|
mod render;
|
2023-10-18 23:47:05 +00:00
|
|
|
|
2023-10-22 17:44:03 +00:00
|
|
|
fn main() -> Result<ExitCode, CustomError> {
|
2023-10-18 23:26:04 +00:00
|
|
|
let rt = tokio::runtime::Runtime::new()?;
|
2023-12-23 11:38:23 +00:00
|
|
|
rt.block_on(async { main_body().await })
|
2023-10-18 23:26:04 +00:00
|
|
|
}
|
|
|
|
|
2023-10-22 17:44:03 +00:00
|
|
|
async fn main_body() -> Result<ExitCode, CustomError> {
|
2023-10-18 23:26:04 +00:00
|
|
|
let args = Cli::parse();
|
|
|
|
match args.command {
|
2023-10-19 00:21:28 +00:00
|
|
|
Commands::Init(args) => {
|
2023-12-22 00:28:31 +00:00
|
|
|
init_natter_folder(args).await?;
|
2023-10-20 23:13:22 +00:00
|
|
|
}
|
|
|
|
Commands::Build(args) => {
|
|
|
|
build_site(args).await?;
|
2023-10-19 00:21:28 +00:00
|
|
|
}
|
2023-10-18 23:26:04 +00:00
|
|
|
};
|
|
|
|
Ok(ExitCode::SUCCESS)
|
|
|
|
}
|