1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use clap::ArgMatches;

use crate::{open_image, AnyResult};

pub fn main(matches: &ArgMatches) -> AnyResult<()> {
    let img = matches.value_of("img").unwrap();

    let (file, image_info) = open_image(img)?;
    drop(file);

    if matches.is_present("json") {
        println!("{}", serde_json::to_string_pretty(&image_info).unwrap());
    } else {
        println!("{:#?}", image_info);
    }
    Ok(())
}