- 新增 --pin/-P 参数: 保留当前版本号不打补丁, 用于失败后重试发布 - 新增 .emod-ignore: gitignore 风格的打包排除规则, 支持通配符和取反 - 新增 .emod-package: 自定义打包包含规则, 支持通配符匹配 - 添加 preflight_pack_dirs 预检: 在打包前验证行为包/资源包目录和清单文件 - 引入 PackDirs 结构体, 消除重复的目录拼接逻辑 - 修复 ZIP 条目路径在 Windows 使用反斜杠导致网易审核工具报错 - 新增 zip_entry_path 统一使用正斜杠 - 添加 10 个单元测试覆盖核心场景
73 lines
1.8 KiB
Rust
73 lines
1.8 KiB
Rust
use clap::{arg, Args, Parser, Subcommand};
|
|
|
|
pub mod components;
|
|
pub mod create;
|
|
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),
|
|
/// Create a new component
|
|
Components(ComponentsArgs),
|
|
}
|
|
|
|
#[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 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>
|
|
}
|