38 lines
838 B
Rust
38 lines
838 B
Rust
#![feature(let_chains)]
|
|
#![feature(async_closure)]
|
|
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;
|
|
mod cli;
|
|
mod command;
|
|
mod config;
|
|
mod context;
|
|
mod error;
|
|
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> {
|
|
let args = Cli::parse();
|
|
match args.command {
|
|
Commands::Init(args) => {
|
|
init_natter_folder(args).await?;
|
|
}
|
|
Commands::Build(args) => {
|
|
build_site(args).await?;
|
|
}
|
|
};
|
|
Ok(ExitCode::SUCCESS)
|
|
}
|