ggen_cli_lib/cmds/template/
mod.rs1use clap::Subcommand;
2use ggen_utils::error::Result;
3
4pub mod lint;
5pub mod list;
6pub mod new;
7pub mod regenerate;
8pub mod show;
9
10#[derive(clap::Args, Debug)]
11pub struct TemplateCmd {
12 #[command(subcommand)]
13 pub verb: Verb,
14}
15
16#[derive(Subcommand, Debug)]
17pub enum Verb {
18 New(new::NewArgs),
20 List(list::ListArgs),
22 Show(show::ShowArgs),
24 Lint(lint::LintArgs),
26 Regenerate(regenerate::RegenerateArgs),
28}
29
30impl TemplateCmd {
31 pub async fn run(&self) -> Result<()> {
32 match &self.verb {
33 Verb::New(args) => new::run(args).await,
34 Verb::List(args) => list::run(args).await,
35 Verb::Show(args) => show::run(args).await,
36 Verb::Lint(args) => lint::run(args).await,
37 Verb::Regenerate(args) => regenerate::run(args)
38 .await
39 .map_err(|e| ggen_utils::error::Error::new(&e.to_string())),
40 }
41 }
42}