2026-05-09 22:02:15 +08:00
|
|
|
use clap::{Args, Parser, Subcommand, arg};
|
2025-11-29 17:31:00 +08:00
|
|
|
|
|
|
|
|
pub mod components;
|
|
|
|
|
pub mod create;
|
2026-05-16 00:59:51 +08:00
|
|
|
pub mod debug;
|
2026-05-14 22:16:18 +08:00
|
|
|
pub mod init;
|
2025-11-29 17:31:00 +08:00
|
|
|
pub mod release;
|
|
|
|
|
|
|
|
|
|
#[derive(Parser)]
|
|
|
|
|
#[command(
|
|
|
|
|
name = "emod-cli",
|
|
|
|
|
version = "1.0.0",
|
|
|
|
|
about = "Convenient Management of NetEase Minecraft Mod Project",
|
|
|
|
|
allow_external_subcommands = true,
|
|
|
|
|
long_about = None,
|
|
|
|
|
propagate_version = true
|
|
|
|
|
)]
|
|
|
|
|
pub struct Cli {
|
|
|
|
|
#[command(subcommand)]
|
|
|
|
|
pub command: Commands,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Subcommand)]
|
|
|
|
|
pub enum Commands {
|
|
|
|
|
/// Release a new version
|
|
|
|
|
Release(ReleaseArgs),
|
|
|
|
|
/// Create a new mod project
|
|
|
|
|
Create(CreateArgs),
|
2026-05-14 22:16:18 +08:00
|
|
|
/// Initialize standard empty directories for an existing project
|
|
|
|
|
Init(InitArgs),
|
2025-11-29 17:31:00 +08:00
|
|
|
/// Create a new component
|
|
|
|
|
Components(ComponentsArgs),
|
2026-05-16 00:59:51 +08:00
|
|
|
/// Launch NetEase Minecraft with debug MOD, IPC logging, and hot reload
|
|
|
|
|
Debug(DebugArgs),
|
2025-11-29 17:31:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Args)]
|
|
|
|
|
pub struct ReleaseArgs {
|
|
|
|
|
/// The path of the project
|
|
|
|
|
#[arg(short, long)]
|
|
|
|
|
pub path: Option<String>,
|
|
|
|
|
/// The version of the project
|
2026-05-04 01:31:44 +08:00
|
|
|
#[arg(short, long, conflicts_with = "pin")]
|
2025-11-29 17:31:00 +08:00
|
|
|
pub ver: Option<String>,
|
2026-05-04 01:31:44 +08:00
|
|
|
/// Reuse the current version without auto-incrementing.
|
|
|
|
|
/// Useful when retrying after a failed release that already wrote new version files.
|
|
|
|
|
#[arg(short = 'P', long, conflicts_with = "ver")]
|
|
|
|
|
pub pin: bool,
|
2025-11-29 17:31:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Args)]
|
|
|
|
|
pub struct CreateArgs {
|
|
|
|
|
/// The name of the mod
|
|
|
|
|
#[arg(short, long)]
|
|
|
|
|
pub name: String,
|
|
|
|
|
/// Example target, default example is 'default'
|
|
|
|
|
#[arg(short, long)]
|
|
|
|
|
pub target: Option<String>,
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-14 22:16:18 +08:00
|
|
|
#[derive(Args)]
|
|
|
|
|
pub struct InitArgs {
|
|
|
|
|
/// The path of the project (default: current directory)
|
|
|
|
|
#[arg(short, long)]
|
|
|
|
|
pub path: Option<String>,
|
|
|
|
|
/// Example target whose layout to apply
|
|
|
|
|
#[arg(short, long)]
|
|
|
|
|
pub target: Option<String>,
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-29 17:31:00 +08:00
|
|
|
#[derive(Args)]
|
|
|
|
|
pub struct ComponentsArgs {
|
|
|
|
|
/// The path of the project
|
|
|
|
|
#[arg(short, long)]
|
|
|
|
|
pub path: Option<String>,
|
|
|
|
|
/// The name of the component
|
|
|
|
|
#[arg(short, long)]
|
|
|
|
|
pub component: String,
|
|
|
|
|
/// Import the path of the geo file.
|
|
|
|
|
#[arg(short, long)]
|
|
|
|
|
pub geo: Option<String>,
|
|
|
|
|
/// Import the path of the texture file.
|
|
|
|
|
#[arg(short, long)]
|
|
|
|
|
pub texture: Option<String>,
|
|
|
|
|
/// The item's identifier
|
|
|
|
|
#[arg(short, long)]
|
2026-05-09 22:02:15 +08:00
|
|
|
pub identifier: Option<String>,
|
2025-11-29 17:31:00 +08:00
|
|
|
}
|
2026-05-16 00:59:51 +08:00
|
|
|
|
|
|
|
|
#[derive(Args)]
|
|
|
|
|
pub struct DebugArgs {
|
|
|
|
|
/// The path of the project (default: current directory)
|
|
|
|
|
#[arg(short, long)]
|
|
|
|
|
pub path: Option<String>,
|
2026-05-16 17:24:13 +08:00
|
|
|
/// Create a fresh debug world and persist it in .mcdev.json
|
|
|
|
|
#[arg(short = 'n', long = "new")]
|
|
|
|
|
pub new_world: bool,
|
2026-05-16 00:59:51 +08:00
|
|
|
}
|