rocket_cli/commands/
mod.rs

1pub mod add;
2pub mod build;
3pub mod new;
4pub mod run;
5
6use clap::{Args, Subcommand};
7
8#[derive(Debug, Subcommand)]
9pub enum Command {
10    /// Scaffold a new Rocket project
11    New(NewArgs),
12
13    /// Run the Rocket application
14    Run,
15}
16
17#[derive(Debug, Args)]
18pub struct NewArgs {
19    /// Project name
20    pub name: Option<String>,
21
22    /// Initialize a git repository
23    #[arg(long, help = "Initialize a git repository")]
24    pub git: bool,
25
26    /// Template name
27    #[arg(
28        long,
29        default_value = "minimal",
30        help = "Choose template: minimal, mongodb, postgres, mysql, mssql, sqlite"
31    )]
32    pub template: String,
33
34    /// List all available templates
35    #[arg(long, help = "List available templates")]
36    pub list: bool,
37}
38
39pub fn handle_command(cmd: Command) {
40    match cmd {
41        Command::New(args) => new::handle(args),
42        Command::Run => run::execute(),
43    }
44}