helix/dna/cmd/
init.rs

1use clap::Args;
2use std::path::PathBuf;
3
4#[derive(Args)]
5pub struct InitArgs {
6    /// Target directory to analyze (defaults to current directory)
7    #[arg(short, long)]
8    name: Option<String>,
9
10    /// Output file path (defaults to stdout if not specified)
11    #[arg(short, long)]
12    dir: Option<PathBuf>,
13
14    /// Template (defaults to minimal)
15    #[arg(short, long, default_value = "minimal")]
16    template: String,
17
18    #[arg(short, long)]
19    force: bool,
20}
21
22#[derive(Args)]
23pub struct InstallArgs {
24    /// Local only (defaults to false)
25    #[arg(long)]
26    local_only: bool,
27
28    /// Force (defaults to false)
29    #[arg(short, long)]
30    force: bool,
31
32    /// Verbose (defaults to false)
33    #[arg(short, long)]
34    verbose: bool,
35}
36
37pub enum InitInstallArgs {
38    Init(InitArgs),
39    Install(InstallArgs),
40}
41
42pub fn run(args: InitInstallArgs) -> anyhow::Result<()> {
43    match args {
44        InitInstallArgs::Install(install_args) => {
45            println!("Install command: local_only={}, force={}, verbose={}",
46                     install_args.local_only, install_args.force, install_args.verbose);
47            Ok(())
48        }
49        InitInstallArgs::Init(init_args) => {
50            let name = init_args.name.unwrap_or_else(|| String::from(""));
51            let dir = init_args.dir.unwrap_or_else(|| PathBuf::from("."));
52            let template = init_args.template;
53            let force = init_args.force;
54            println!("Init command: name={}, dir={}, template={}, force={}",
55                     name, dir.display(), template, force);
56            Ok(())
57        }
58    }
59}