diff --git a/tools/editor/cli_help.cpp b/tools/editor/cli_help.cpp index 92ae57f7..a3278c98 100644 --- a/tools/editor/cli_help.cpp +++ b/tools/editor/cli_help.cpp @@ -789,6 +789,8 @@ void printUsage(const char* argv0) { std::printf(" --pack-wcp [dst] Pack a zone dir/name into a .wcp archive and exit\n"); std::printf(" --unpack-wcp [dst] Extract a WCP archive (default dst=custom_zones/) and exit\n"); std::printf(" --list-commands Print every recognized --flag, one per line, and exit\n"); + std::printf(" --list-primitives [--mesh|--texture] [--json]\n"); + std::printf(" Filtered list of just procedural primitive flags (--gen-mesh-*, --gen-texture-*)\n"); std::printf(" --info-cli-stats [--json]\n"); std::printf(" Meta-stats on the CLI surface (command count by category prefix)\n"); std::printf(" --info-cli-categories\n"); diff --git a/tools/editor/cli_introspect.cpp b/tools/editor/cli_introspect.cpp index 05ac0153..78616f5b 100644 --- a/tools/editor/cli_introspect.cpp +++ b/tools/editor/cli_introspect.cpp @@ -371,12 +371,69 @@ int handleVersion(int& /*i*/, int /*argc*/, char** /*argv*/) { return 0; } +int handleListPrimitives(int& i, int argc, char** argv) { + // Focused subset of --list-commands: just the procedural + // primitives (--gen-mesh-* and --gen-texture-* flags). Useful + // when authoring content packs to discover what's available + // without scrolling through the full --help dump. Walks the + // shared kArgRequired registry so it auto-tracks new + // primitives as they're added — no parallel list. + bool jsonOut = false; + bool meshOnly = false; + bool textureOnly = false; + while (i + 1 < argc && argv[i + 1][0] == '-') { + if (std::strcmp(argv[i + 1], "--json") == 0) { + jsonOut = true; ++i; + } else if (std::strcmp(argv[i + 1], "--mesh") == 0) { + meshOnly = true; ++i; + } else if (std::strcmp(argv[i + 1], "--texture") == 0) { + textureOnly = true; ++i; + } else { + break; + } + } + std::vector meshes; + std::vector textures; + for (std::size_t k = 0; k < kArgRequiredSize; ++k) { + const char* flag = kArgRequired[k]; + if (std::strncmp(flag, "--gen-mesh-", 11) == 0) { + meshes.emplace_back(flag); + } else if (std::strncmp(flag, "--gen-texture-", 14) == 0) { + textures.emplace_back(flag); + } + } + std::sort(meshes.begin(), meshes.end()); + std::sort(textures.begin(), textures.end()); + if (jsonOut) { + nlohmann::json j; + if (!textureOnly) j["meshes"] = meshes; + if (!meshOnly) j["textures"] = textures; + if (!textureOnly) j["meshCount"] = meshes.size(); + if (!meshOnly) j["textureCount"] = textures.size(); + std::printf("%s\n", j.dump(2).c_str()); + return 0; + } + if (!textureOnly) { + std::printf("Procedural meshes (%zu):\n", meshes.size()); + for (const auto& m : meshes) std::printf(" %s\n", m.c_str()); + } + if (!meshOnly) { + if (!textureOnly) std::printf("\n"); + std::printf("Procedural textures (%zu):\n", textures.size()); + for (const auto& t : textures) std::printf(" %s\n", t.c_str()); + } + return 0; +} + } // namespace bool handleIntrospect(int& i, int argc, char** argv, int& outRc) { if (std::strcmp(argv[i], "--list-commands") == 0) { outRc = handleListCommands(i, argc, argv); return true; } + if (std::strcmp(argv[i], "--list-primitives") == 0) { + outRc = handleListPrimitives(i, argc, argv); return true; + } if (std::strcmp(argv[i], "--info-cli-stats") == 0) { outRc = handleInfoCliStats(i, argc, argv); return true; }