use anyhow::Result;
use clap::Parser;
mod commands;
pub mod template;
pub mod utils;
#[derive(Debug, Parser)]
#[clap(version)]
pub struct Opts {
#[clap(subcommand)]
pub command: Command,
}
#[derive(Debug, Parser)]
pub enum Command {
Build,
Serve,
Test,
Clean,
Init {
name: String,
},
New {
name: String,
},
}
fn process_command(opts: Opts) -> Result<()> {
match &opts.command {
Command::Build => Ok(commands::build::run()),
Command::Serve => Ok(commands::serve::run()),
Command::Test => Ok(commands::test::run()),
Command::Clean => Ok(commands::clean::run()),
Command::Init { name } => Ok(commands::init::run(&name)),
Command::New { name } => Ok(commands::new::run(&name)),
}
}
pub fn entry(opts: Opts) -> Result<()> {
process_command(opts)
}