feat: parse and display XEX2 main header (M1)
Implement XEX2 main header parsing with module flag decoding. Add error handling, big-endian read utilities, CLI entry point, and comprehensive unit + integration tests against a sample file. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
28
src/main.rs
28
src/main.rs
@@ -1,3 +1,29 @@
|
||||
use std::process;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
let path = match std::env::args().nth(1) {
|
||||
Some(p) => p,
|
||||
None => {
|
||||
eprintln!("Usage: xex2tractor <file.xex>");
|
||||
process::exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
let data = match std::fs::read(&path) {
|
||||
Ok(d) => d,
|
||||
Err(e) => {
|
||||
eprintln!("Error reading {path}: {e}");
|
||||
process::exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
let xex = match xex2tractor::parse(&data) {
|
||||
Ok(x) => x,
|
||||
Err(e) => {
|
||||
eprintln!("Error parsing XEX2: {e}");
|
||||
process::exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
xex2tractor::display::display_header(&xex.header);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user