use clap::{Parser, Subcommand};
mod new;
#[derive(Debug, Parser)]
#[command(author, version, about, long_about = None)]
pub struct Startup {
#[clap(short,long,action=clap::ArgAction::Count)]
debug: u8,
#[command(subcommand)]
command: Command,
}
#[derive(Debug, Subcommand)]
enum Command {
New,
}
impl Startup {
pub fn start() -> Self {
Startup::parse()
}
pub fn run(&self) {
let level = if self.debug > 0 {
tracing::Level::TRACE
} else {
tracing::Level::INFO
};
tracing_subscriber::fmt().with_max_level(level).init();
self.command.run();
}
}
impl Command {
fn run(&self) {
match self {
Command::New => new::create_new_project(),
}
}
}