natter/src/main.rs

36 lines
798 B
Rust
Raw Normal View History

#![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;
use self::command::build::build_site;
2023-12-22 00:28:31 +00:00
use self::command::init::init_natter_folder;
use self::error::CustomError;
2023-10-18 23:47:05 +00:00
mod cli;
mod command;
mod config;
mod context;
mod error;
mod intermediate;
mod render;
2023-10-18 23:47:05 +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
}
async fn main_body() -> Result<ExitCode, CustomError> {
2023-10-18 23:26:04 +00:00
let args = Cli::parse();
match args.command {
Commands::Init(args) => {
2023-12-22 00:28:31 +00:00
init_natter_folder(args).await?;
}
Commands::Build(args) => {
build_site(args).await?;
}
2023-10-18 23:26:04 +00:00
};
Ok(ExitCode::SUCCESS)
}