added nosize arg
This commit is contained in:
@@ -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}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user