1use clap::{Parser, Subcommand};
2mod new;
3
4#[derive(Debug, Parser)]
5#[command(author, version, about, long_about = None)]
6pub struct Startup {
7 #[clap(short,long,action=clap::ArgAction::Count)]
9 debug: u8,
10
11 #[command(subcommand)]
12 command: Command,
13}
14
15#[derive(Debug, Subcommand)]
17enum Command {
18 New,
20}
21
22impl Startup {
24 pub fn start() -> Self {
25 Startup::parse()
26 }
27
28 pub fn run(&self) {
29 let level = if self.debug > 0 {
31 tracing::Level::TRACE
32 } else {
33 tracing::Level::INFO
34 };
35 tracing_subscriber::fmt().with_max_level(level).init();
36 self.command.run();
38 }
39}
40
41impl Command {
43 fn run(&self) {
44 match self {
45 Command::New => new::create_new_project(),
46 }
47 }
48}