cli/commands/
mod.rs

1pub mod build;
2pub mod log;
3pub mod new;
4pub mod run;
5
6use crate::error::Result;
7use clap::Clap;
8use creator_tools::utils::Config;
9
10#[derive(Clap, Clone, Debug)]
11pub enum Commands {
12    /// Starts the process of building/packaging/signing of the rust crate
13    Build(build::BuildCommand),
14    /// Executes `build` command and then deploy and launches the application on the device/emulator
15    Run(run::RunCommand),
16    /// Creates a new Cargo package in the given directory. Project will be ready to build with `creator`
17    New(new::NewCommand),
18    /// Attach logger to device with running application
19    Log(log::LogCommand),
20}
21
22impl Commands {
23    pub fn handle_command(&self, config: &Config) -> Result<()> {
24        match self {
25            Commands::Build(cmd) => cmd.handle_command(config),
26            Commands::Run(cmd) => cmd.handle_command(config),
27            Commands::New(cmd) => cmd.handle_command(config),
28            Commands::Log(cmd) => cmd.handle_command(config),
29        }
30    }
31}