greentic_bundle/cli/
build.rs1use std::path::PathBuf;
2
3use anyhow::Result;
4use clap::Args;
5
6#[derive(Debug, Args)]
7pub struct BuildArgs {
8 #[arg(long, default_value = ".", help = "cli.build.root.option")]
9 pub root: PathBuf,
10
11 #[arg(long, value_name = "FILE", help = "cli.build.output.option")]
12 pub output: Option<PathBuf>,
13
14 #[arg(long, default_value_t = false, help = "cli.option.dry_run")]
15 pub dry_run: bool,
16}
17
18impl Default for BuildArgs {
19 fn default() -> Self {
20 Self {
21 root: PathBuf::from("."),
22 output: None,
23 dry_run: false,
24 }
25 }
26}
27
28pub fn run(args: BuildArgs) -> Result<()> {
29 let result = crate::build::build_workspace(&args.root, args.output.as_deref(), args.dry_run)?;
30 println!("{}", serde_json::to_string_pretty(&result)?);
31 Ok(())
32}