v6/src/main.rs

38 lines
846 B
Rust
Raw Normal View History

2022-12-10 13:15:32 -05:00
#![feature(let_chains)]
mod generator;
use clap::{Command, arg, command};
2022-12-10 13:15:32 -05:00
use log::info;
#[tokio::main]
async fn main() {
env_logger::init();
let matches = command!()
.subcommand_required(true)
.arg_required_else_help(true)
.subcommand(Command::new("gen"))
.subcommand(
Command::new("serve")
.arg(arg!(--watch "Watch the site directory and regenerate on changes")),
)
.get_matches();
2023-01-06 00:23:26 -05:00
if cfg!(debug_assertions) {
2023-01-06 00:17:41 -05:00
info!("Running in dev mode");
2023-01-06 00:26:21 -05:00
} else {
info!("Running in release mode");
2023-01-06 00:17:41 -05:00
}
2022-12-10 13:15:32 -05:00
match matches.subcommand() {
Some(("gen", _)) => {
generator::generate().await.expect("generating");
2022-12-10 13:15:32 -05:00
}
Some(("serve", _matches)) => {
todo!()
2022-12-10 13:15:32 -05:00
}
_ => unreachable!(),
}
}