1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use clap::Parser;
use std::error::Error;

fn main() {
    jcli_lib::JCli::parse().exec().unwrap_or_else(report_error)
}

fn report_error(error: Box<dyn Error>) {
    eprintln!("{}", error);
    let mut source = error.source();
    while let Some(sub_error) = source {
        eprintln!("  |-> {}", sub_error);
        source = sub_error.source();
    }
    std::process::exit(1)
}