//! Why does the decoder refuse a grouped-pool resource at a given pool start?
//! Usage: why_rejected <container.xpr> <resource>@<vb0-hex>...
use sylpheed_formats::mesh::debug_grouped_report;
fn main() {
    let a: Vec<String> = std::env::args().collect();
    let bytes = std::fs::read(&a[1]).expect("container");
    for pair in &a[2..] {
        let (name, off) = pair.split_once('@').expect("name@hex");
        let vb0 = usize::from_str_radix(off.trim_start_matches("0x"), 16).expect("hex");
        for line in debug_grouped_report(&bytes, name, vb0) {
            println!("{line}");
        }
    }
}
