Use clap for processing arguments.

This commit is contained in:
Lyle Mantooth 2022-05-31 17:08:52 -04:00
parent 4112573d85
commit f6eb37b6fe
Signed by: IslandUsurper
GPG key ID: 6DB52EAE123A5789
3 changed files with 193 additions and 2 deletions

View file

@ -7,6 +7,7 @@ edition = "2021"
[dependencies]
anyhow = "1"
clap = { version = "3.1.18", features = ["derive"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
thiserror = "1"

View file

@ -1,3 +1,33 @@
fn main() {
println!("Hello, world!");
use std::path::PathBuf;
use clap::Parser;
/// Randomizes enemy placements in The Legend of Zelda: A Link to the Past for the Super Nintendo
/// Entertainment System
#[derive(Debug, Parser)]
#[clap(author, version, about)]
struct Args {
/// path to the base rom file
rom: PathBuf,
/// seed number
#[clap(short, long)]
seed: Option<u32>,
/// path to the base2patched.json (not used in binary mode)
#[clap(short, long, required_unless_present = "binary")]
base: Option<PathBuf>,
/// path to the randomizerPatch.json (not used in binary mode)
#[clap(short, long, required_unless_present = "binary")]
randomizer: Option<PathBuf>,
/// path to the enemizerOptions.json
#[clap(short, long)]
enemizer: PathBuf,
/// path to the intended output file
output: PathBuf,
/// operate in binary mode (takes already randomized SFC and applies enemizer directly to ROM)
#[clap(long)]
binary: bool,
}
fn main() {
let args = Args::parse();
}