legacympt-rs/mpt/src/main.rs
2021-08-29 15:14:10 +02:00

50 lines
1.1 KiB
Rust

use std::path::PathBuf;
use structopt::StructOpt;
mod commands;
mod config;
mod forge;
mod util;
#[derive(StructOpt)]
struct Opt {
#[structopt(subcommand)]
cmd: Command,
}
#[derive(StructOpt)]
enum Command {
Init {
#[structopt(help = "The name of the modpack")]
modpack_name: String,
#[structopt(help = "The minecraft version of the modpack")]
mcversion: String,
},
#[structopt(name = "downloadmods")]
DownloadMods {
#[structopt(help = "Directory to download mods to")]
dir: PathBuf,
#[structopt(short, long, help = "Download all relations and not just mods")]
all: bool,
},
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let Opt { cmd } = Opt::from_args();
match cmd {
Command::Init {
modpack_name,
mcversion,
} => commands::init::run(modpack_name, mcversion).await?,
Command::DownloadMods { dir, all } => {
commands::downloadmods::run(util::parse_config_and_manifest().await?, dir, all).await?
},
}
Ok(())
}