42 lines
811 B
Rust
42 lines
811 B
Rust
mod commands;
|
|
|
|
use clap::{Parser, Subcommand};
|
|
use log::{error, info};
|
|
use std::error::Error;
|
|
|
|
#[derive(Parser, Debug)]
|
|
struct Cli {
|
|
#[command(subcommand)]
|
|
command: Commands,
|
|
}
|
|
|
|
#[derive(Subcommand, Debug)]
|
|
enum Commands {
|
|
BuildMpq(commands::build_mpq::BuildMpqCommand),
|
|
}
|
|
|
|
#[tokio::main]
|
|
async fn main() {
|
|
env_logger::builder()
|
|
.filter_level(log::LevelFilter::Debug)
|
|
.format_target(false)
|
|
.format_timestamp(None)
|
|
.init();
|
|
|
|
let args = Cli::parse();
|
|
|
|
if let Err(err) = run(args).await {
|
|
error!("{}", err);
|
|
|
|
std::process::exit(1);
|
|
}
|
|
}
|
|
|
|
async fn run(args: Cli) -> Result<(), Box<dyn Error>> {
|
|
info!("Starting tool...");
|
|
|
|
return match args.command {
|
|
Commands::BuildMpq(args) => commands::build_mpq::execute(args),
|
|
};
|
|
}
|