1#![allow(clippy::print_stderr, clippy::print_stdout)]
6
7pub mod commands;
8
9use clap::{Parser, Subcommand};
10
11#[derive(Parser)]
13#[command(name = "dampen")]
14#[command(about = "Developer CLI for Dampen UI framework", long_about = None)]
15#[command(version)]
16pub struct Cli {
17 #[command(subcommand)]
18 command: Commands,
19}
20
21#[derive(Subcommand)]
22pub enum Commands {
23 Build(commands::BuildArgs),
25
26 Check(commands::CheckArgs),
28
29 Inspect(commands::InspectArgs),
31
32 New(commands::NewArgs),
34
35 Release(commands::ReleaseArgs),
37
38 Run(commands::RunArgs),
40
41 Test(commands::TestArgs),
43}
44
45pub fn run() {
47 let cli = Cli::parse();
48
49 let result = match cli.command {
50 Commands::Build(args) => commands::build_execute(&args).map_err(|e| e.to_string()),
51 Commands::Check(args) => commands::check_execute(&args).map_err(|e| e.to_string()),
52 Commands::Inspect(args) => commands::inspect_execute(&args),
53 Commands::New(args) => commands::new_execute(&args),
54 Commands::Release(args) => commands::release_execute(&args),
55 Commands::Run(args) => commands::run_execute(&args).map_err(|e| e.to_string()),
56 Commands::Test(args) => commands::test_execute(&args),
57 };
58
59 if let Err(e) = result {
60 eprintln!("Error: {}", e);
61 std::process::exit(1);
62 }
63}