helix/dna/cmd/
generate.rs

1
2use std::path::PathBuf;
3use clap::Args;
4
5/// Arguments for the `generate` command.
6#[derive(Debug, Args)]
7pub struct GenerateArgs {
8    /// The template to use for code generation.
9    #[arg(value_name = "TEMPLATE")]
10    pub template: String,
11
12    /// Output path for the generated code.
13    #[arg(short, long, value_name = "OUTPUT")]
14    pub output: Option<PathBuf>,
15
16    /// Optional name for the generated artifact.
17    #[arg(short, long, value_name = "NAME")]
18    pub name: Option<String>,
19
20    /// Overwrite existing files if present.
21    #[arg(short, long)]
22    pub force: bool,
23
24    /// Enable verbose output.
25    #[arg(short, long)]
26    pub verbose: bool,
27}
28
29/// Run the generate command with the provided arguments.
30pub fn run(args: GenerateArgs) -> anyhow::Result<()> {
31    crate::dna::mds::generate::generate_code(
32        args.template,
33        args.output,
34        args.name,
35        args.force,
36        args.verbose,
37    )
38}