feat: 修改逻辑,init不负责生成项目结构,只生成project.cloud

This commit is contained in:
Luke 2025-06-24 10:18:17 +08:00
parent 8a78073e90
commit bd9691b7eb

View File

@ -7,9 +7,9 @@ import java.nio.file.Path;
import java.nio.file.Paths;
/**
* CLI 命令创建新的项目骨架
* CLI 命令初始化项目配置文件
* <p>
* 用于快速初始化标准目录结构和 DSL 配置文件project.cloud
* 用于快速生成 DSL 配置文件project.cloud
* </p>
*
* <pre>
@ -36,7 +36,7 @@ public final class InitCommand implements CLICommand {
*/
@Override
public String description() {
return "Initialize a new project skeleton with directory structure and project.cloud file.";
return "Initialize a new project with project.cloud file.";
}
/**
@ -44,11 +44,11 @@ public final class InitCommand implements CLICommand {
*/
@Override
public void printUsage() {
System.out.println("Usage: snow init [--lang <lang>]");
System.out.println("Usage: snow init");
}
/**
* 执行项目初始化流程创建 src 目录和 DSL 配置文件
* 执行项目初始化流程创建 DSL 配置文件
*
* @param args CLI 传入的参数数组
* @return 执行结果码0 表示成功
@ -56,9 +56,8 @@ public final class InitCommand implements CLICommand {
*/
@Override
public int execute(String[] args) throws Exception {
// 生成 skeleton `.cloud` 文件 src 目录
// 生成 `.cloud` 文件
Path dir = Paths.get(".").toAbsolutePath();
Files.createDirectories(dir.resolve("src"));
Path dsl = dir.resolve("project.cloud");
if (Files.notExists(dsl)) {
Files.writeString(dsl, """