added nosize arg
This commit is contained in:
@@ -1,13 +1,25 @@
|
|||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use std::{borrow::Cow, env::args};
|
use std::{borrow::Cow, env::args, process::exit};
|
||||||
|
|
||||||
fn main() {
|
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());
|
let (data, name, width, height) = path_to_img(path.as_str());
|
||||||
|
|
||||||
println!("{name}:");
|
println!("{name}:");
|
||||||
|
if !nosize {
|
||||||
println!(" D {width}");
|
println!(" D {width}");
|
||||||
println!(" D {height}");
|
println!(" D {height}");
|
||||||
|
}
|
||||||
for d in data {
|
for d in data {
|
||||||
println!(" D 0x{d:08x}");
|
println!(" D 0x{d:08x}");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user