1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
pub mod build;
pub mod new;
pub mod run;

use crate::error::Result;
use clap::Clap;
use creator_tools::utils::Config;

#[derive(Clap, Clone, Debug)]
pub enum Commands {
    Build(build::BuildCommand),
    Run(run::RunCommand),
    New(new::NewCommand),
}

impl Commands {
    pub fn handle_command(&self, config: &Config) -> Result<()> {
        match self {
            Commands::Build(cmd) => cmd.handle_command(config),
            Commands::Run(cmd) => cmd.handle_command(config),
            Commands::New(cmd) => cmd.handle_command(config),
        }
    }
}