1use clap::Args;
2use std::path::PathBuf;
3
4#[derive(Args)]
5pub struct BundleArgs {
6 directory: PathBuf,
7 #[arg(short, long)]
9 input: Option<PathBuf>,
10
11 #[arg(short, long)]
13 output: Option<PathBuf>,
14
15 #[arg(short, long)]
17 include: Vec<String>,
18
19 #[arg(short = 'x', long)]
21 exclude: Vec<String>,
22
23 #[arg(long)]
25 tree_shake: bool,
26
27 #[arg(short = 'O', long, default_value = "2")]
29 optimize: u8,
30
31
32
33}
34
35pub fn run(args: BundleArgs) -> anyhow::Result<()> {
36 let input = args.input.unwrap_or_else(|| PathBuf::from("."));
37 let output = args.output.unwrap_or_else(|| PathBuf::from("bundle.hlxb"));
38 let include = args.include;
39 let exclude = args.exclude;
40 let tree_shake = args.tree_shake;
41 let optimize = args.optimize;
42 crate::dna::mds::bundle::bundle_command(input, output, include, exclude, tree_shake, optimize, false)
43 .map_err(|e| anyhow::anyhow!("Bundle command failed: {}", e))?;
44 Ok(())
45}