added nosize arg

This commit is contained in:
Mwa
2026-03-18 15:07:05 +01:00
parent 5c5d8471fa
commit c844f8d806

View File

@@ -1,13 +1,25 @@
use regex::Regex;
use std::{borrow::Cow, env::args};
use std::{borrow::Cow, env::args, process::exit};
fn main() {
let path = args().nth(1).expect("usage: 1 image file argument");
let path = args().nth(1).expect("usage: file [--nosize]");
let nosize = match args().nth(2) {
None => false,
Some(t) => {
if t == "--nosize" {
true
} else {
eprint!("usage: file [--nosize]");
exit(1)
}
}
};
let (data, name, width, height) = path_to_img(path.as_str());
println!("{name}:");
println!(" D {width}");
println!(" D {height}");
if !nosize {
println!(" D {width}");
println!(" D {height}");
}
for d in data {
println!(" D 0x{d:08x}");
}