#![allow(clippy::print_stderr, clippy::print_stdout)]
pub mod commands;
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(name = "dampen")]
#[command(about = "Developer CLI for Dampen UI framework", long_about = None)]
#[command(version)]
pub struct Cli {
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
Add(commands::AddArgs),
Build(commands::BuildArgs),
Check(commands::CheckArgs),
Inspect(commands::InspectArgs),
New(commands::NewArgs),
Release(commands::ReleaseArgs),
Run(commands::RunArgs),
Test(commands::TestArgs),
}
pub fn run() {
let cli = Cli::parse();
let result = match cli.command {
Commands::Add(args) => commands::add_execute(&args),
Commands::Build(args) => commands::build_execute(&args).map_err(|e| e.to_string()),
Commands::Check(args) => commands::check_execute(&args).map_err(|e| e.to_string()),
Commands::Inspect(args) => commands::inspect_execute(&args),
Commands::New(args) => commands::new_execute(&args),
Commands::Release(args) => commands::release_execute(&args),
Commands::Run(args) => commands::run_execute(&args).map_err(|e| e.to_string()),
Commands::Test(args) => commands::test_execute(&args),
};
if let Err(e) = result {
eprintln!("Error: {}", e);
std::process::exit(1);
}
}