mod check;
mod run;
mod scaffold;
use dotzuki_runner::manifest;
use std::path::PathBuf;
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(
name = "dotzuki",
version,
about = "dotzuki-engine game project tool — scaffold, check and run zero-Rust game projects"
)]
struct Cli {
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
New {
name: String,
#[arg(long)]
dir: Option<PathBuf>,
#[arg(long)]
title: Option<String>,
},
Check {
dir: PathBuf,
},
Run {
dir: PathBuf,
#[arg(long)]
map: Option<String>,
#[arg(long, default_value = "en", value_parser = ["en", "zh"])]
lang: String,
#[arg(long)]
headless: bool,
#[arg(long, default_value_t = 120)]
frames: u32,
#[arg(long)]
screenshot: Option<PathBuf>,
#[arg(long, default_value_t = 3)]
scale: u32,
#[arg(long)]
watch: bool,
#[arg(long)]
fresh: bool,
#[arg(long)]
save_file: Option<PathBuf>,
#[arg(long)]
save: bool,
},
}
fn main() -> anyhow::Result<()> {
let cli = Cli::parse();
match cli.command {
Commands::New { name, dir, title } => {
scaffold::run(&name, dir.as_deref(), title.as_deref())?;
}
Commands::Check { dir } => check::run(&dir)?,
Commands::Run {
dir,
map,
lang,
headless,
frames,
screenshot,
scale,
watch,
fresh,
save_file,
save,
} => run::run(run::RunArgs {
dir,
map,
lang,
headless,
frames,
screenshot,
scale,
watch,
fresh,
save_file,
save,
})?,
}
Ok(())
}