1mod init;
2mod make;
3mod run;
4
5use std::process::exit;
6
7use clap::{Parser, Subcommand};
8
9#[derive(Parser)]
10#[command(author, version, about)]
11pub struct Cli {
12 #[command(subcommand)]
13 command: Option<Commands>,
14}
15
16#[derive(Subcommand, Debug)]
17enum Commands {
18 Init,
20
21 Run,
23
24 Make(make::Make),
26}
27
28impl Cli {
29 pub fn run() {
30 let cli = Cli::parse();
31
32 match &cli.command {
33 Some(command) => match command {
34 Commands::Init => {
35 init::init();
36 }
37
38 Commands::Run => {
39 run::run();
40 }
41
42 Commands::Make(s) => match &s.command {
43 make::Commands::Route(r) => {
44 println!("route: {:#?}", r);
45 }
46 make::Commands::Migrate => println!("migrate"),
47 },
48 },
49 None => {
50 exit(0);
51 }
52 }
53 }
54}