新增 debug 子命令,自动准备开发世界、注册内置调试 MOD,并将项目行为包和资源包链接到网易运行目录,方便启动游戏后直接进入调试世界。 调试 MOD 资源随仓库一起嵌入,避免依赖本机绝对路径;Windows junction 写入剥离 verbatim 前缀后的 DOS 路径,保证 Minecraft 能正确读取链接包。
96 lines
2.4 KiB
Rust
96 lines
2.4 KiB
Rust
use clap::{Args, Parser, Subcommand, arg};
|
|
|
|
pub mod components;
|
|
pub mod create;
|
|
pub mod debug;
|
|
pub mod init;
|
|
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),
|
|
/// Initialize standard empty directories for an existing project
|
|
Init(InitArgs),
|
|
/// Create a new component
|
|
Components(ComponentsArgs),
|
|
/// Launch NetEase Minecraft with debug MOD, IPC logging, and hot reload
|
|
Debug(DebugArgs),
|
|
}
|
|
|
|
#[derive(Args)]
|
|
pub struct ReleaseArgs {
|
|
/// The path of the project
|
|
#[arg(short, long)]
|
|
pub path: Option<String>,
|
|
/// The version of the project
|
|
#[arg(short, long, conflicts_with = "pin")]
|
|
pub ver: Option<String>,
|
|
/// 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,
|
|
}
|
|
|
|
#[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>,
|
|
}
|
|
|
|
#[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>,
|
|
}
|
|
|
|
#[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)]
|
|
pub identifier: Option<String>,
|
|
}
|
|
|
|
#[derive(Args)]
|
|
pub struct DebugArgs {
|
|
/// The path of the project (default: current directory)
|
|
#[arg(short, long)]
|
|
pub path: Option<String>,
|
|
}
|