use std::path::PathBuf;
use argp::FromArgs;
use crate::util::{redump, shared::convert_and_verify};
#[derive(FromArgs, Debug)]
#[argp(subcommand, name = "convert")]
pub struct Args {
#[argp(positional)]
file: PathBuf,
#[argp(positional)]
out: PathBuf,
#[argp(switch)]
md5: bool,
#[argp(option, short = 'd')]
dat: Vec<PathBuf>,
}
pub fn run(args: Args) -> nod::Result<()> {
if !args.dat.is_empty() {
println!("Loading dat files...");
redump::load_dats(args.dat.iter().map(PathBuf::as_ref))?;
}
convert_and_verify(&args.file, Some(&args.out), args.md5)
}