68 lines
1.6 KiB
Rust
68 lines
1.6 KiB
Rust
use std::path::PathBuf;
|
|
use structopt::StructOpt;
|
|
|
|
mod commands;
|
|
mod config;
|
|
mod downloader;
|
|
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 = "Name of the modpack author")]
|
|
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,
|
|
},
|
|
|
|
#[structopt(name = "buildtwitch")]
|
|
BuildTwitch {
|
|
#[structopt(
|
|
short,
|
|
long,
|
|
help = "Downloads all relations instead of just required ones"
|
|
)]
|
|
all: bool,
|
|
},
|
|
}
|
|
|
|
#[tokio::main]
|
|
async fn main() -> anyhow::Result<()> {
|
|
let Opt { cmd } = Opt::from_args();
|
|
|
|
match cmd {
|
|
Command::Init {
|
|
modpack_name,
|
|
name,
|
|
mcversion,
|
|
} => commands::init::run(modpack_name, name, mcversion).await?,
|
|
|
|
Command::DownloadMods { dir, all } => {
|
|
commands::downloadmods::run(util::parse_config_and_manifest().await?, dir, all).await?
|
|
},
|
|
|
|
Command::BuildTwitch { all } => {
|
|
commands::buildtwitch::run(util::parse_config_and_manifest().await?, all).await?
|
|
},
|
|
}
|
|
|
|
Ok(())
|
|
}
|