feat(init): 支持补齐内置模板空目录

新增 init 子命令,根据项目中的 world_*_packs.json 解析实际包目录并创建标准空目录。

改用 .empty-dirs 维护内置模板空目录清单,删除会污染用户项目和网易 Bedrock 加载流程的 .gitkeep 占位文件。
This commit is contained in:
2026-05-14 22:16:18 +08:00
parent 55e92c4b4f
commit de2b804aad
42 changed files with 197 additions and 7 deletions

View File

@@ -2,6 +2,7 @@ use clap::{Args, Parser, Subcommand, arg};
pub mod components;
pub mod create;
pub mod init;
pub mod release;
#[derive(Parser)]
@@ -24,6 +25,8 @@ pub enum Commands {
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),
}
@@ -52,6 +55,16 @@ pub struct CreateArgs {
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