1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use std::path::PathBuf;

use clap::{Args, Parser, Subcommand};

mod bounds;
mod map;

#[derive(Parser)]
#[clap(author, version, about)]
struct Cli {
    #[command(subcommand)]
    command: Command,
}

#[derive(Subcommand)]
enum Command {
    /// Computes and outputs ground footprint and 3D bounds of a GLTF model.
    Bounds(Bounds),
    /// Computes and outputs hash of a Digital Extinction map.
    MapHash(MapHash),
}

#[derive(Args)]
struct Bounds {
    #[clap(short, long, value_parser, help = "Path of a GLTF file.")]
    path: PathBuf,
}

#[derive(Args)]
struct MapHash {
    #[clap(
        short,
        long,
        value_parser,
        help = "Path of a Digital Extinction map file."
    )]
    path: PathBuf,
    #[clap(short, long, help = "Check validity of the file name.")]
    check: bool,
}

fn main() {
    let cli = Cli::parse();

    match cli.command {
        Command::Bounds(args) => bounds::execute(args.path.as_path()),
        Command::MapHash(args) => map::execute(args.path.as_path(), args.check),
    }
}