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
36pub fn run() {
38 let cli = Cli::parse();
39
40 let result = match cli.command {
41 Commands::Build(args) => commands::build_execute(&args).map_err(|e| e.to_string()),
42 Commands::Check(args) => commands::check_execute(&args).map_err(|e| e.to_string()),
43 Commands::Inspect(args) => commands::inspect_execute(&args),
44 Commands::New(args) => commands::new_execute(&args),
45 };
46
47 if let Err(e) = result {
48 eprintln!("Error: {}", e);
49 std::process::exit(1);
50 }
51}