use clap::Args;
use std::path::PathBuf;
#[derive(Args)]
pub struct BundleArgs {
directory: PathBuf,
#[arg(short, long)]
input: Option<PathBuf>,
#[arg(short, long)]
output: Option<PathBuf>,
#[arg(short, long)]
include: Vec<String>,
#[arg(short = 'x', long)]
exclude: Vec<String>,
#[arg(long)]
tree_shake: bool,
#[arg(short = 'O', long, default_value = "2")]
optimize: u8,
}
pub fn run(args: BundleArgs) -> anyhow::Result<()> {
let input = args.input.unwrap_or_else(|| PathBuf::from("."));
let output = args.output.unwrap_or_else(|| PathBuf::from("bundle.hlxb"));
let include = args.include;
let exclude = args.exclude;
let tree_shake = args.tree_shake;
let optimize = args.optimize;
crate::dna::mds::bundle::bundle_command(input, output, include, exclude, tree_shake, optimize, false)
.map_err(|e| anyhow::anyhow!("Bundle command failed: {}", e))?;
Ok(())
}