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 Add(commands::AddArgs),
25
26 Build(commands::BuildArgs),
28
29 Check(commands::CheckArgs),
31
32 Inspect(commands::InspectArgs),
34
35 New(commands::NewArgs),
37
38 Release(commands::ReleaseArgs),
40
41 Run(commands::RunArgs),
43
44 Test(commands::TestArgs),
46}
47
48pub fn run() {
50 let cli = Cli::parse();
51
52 let result = match cli.command {
53 Commands::Add(args) => commands::add_execute(&args),
54 Commands::Build(args) => commands::build_execute(&args).map_err(|e| e.to_string()),
55 Commands::Check(args) => commands::check_execute(&args).map_err(|e| e.to_string()),
56 Commands::Inspect(args) => commands::inspect_execute(&args),
57 Commands::New(args) => commands::new_execute(&args),
58 Commands::Release(args) => commands::release_execute(&args),
59 Commands::Run(args) => commands::run_execute(&args).map_err(|e| e.to_string()),
60 Commands::Test(args) => commands::test_execute(&args),
61 };
62
63 if let Err(e) = result {
64 eprintln!("Error: {}", e);
65 std::process::exit(1);
66 }
67}