use clap::Parser;
use std::error::Error;
use std::path::PathBuf;
use rustsourcebundler::Bundler;
#[derive(Parser, Debug)]
#[command(version, about)]
pub struct Cli {
pub main_rs: PathBuf,
pub output: Option<PathBuf>,
}
pub fn main() -> Result<(), Box<dyn Error>> {
let cli = Cli::parse();
let bundler = if let Some(ref output) = cli.output {
Bundler::new(&cli.main_rs, output)
} else {
Bundler::new_fd(&cli.main_rs, Box::new(std::io::stdout()))
};
bundler.run();
Ok(())
}