MCPcopy Create free account
hub / github.com/OpenSteam001/OpenSteamTool / main

Function main

tools/ipc_codegen/ipc_codegen.cpp:1154–1197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1152} // namespace
1153
1154int main(int argc, char** argv) {
1155 std::string cppOut = ".";
1156 std::vector<std::string> inputs;
1157
1158 for (int i = 1; i < argc; ++i) {
1159 const std::string_view arg = argv[i];
1160 if (arg == "--version") {
1161 std::printf("%s\n", kVersion);
1162 return 0;
1163 }
1164 if (arg == "-h" || arg == "--help") {
1165 printUsage(stdout);
1166 return 0;
1167 }
1168 if (arg.rfind("--cpp_out=", 0) == 0) {
1169 cppOut = std::string(arg.substr(std::string_view("--cpp_out=").size()));
1170 continue;
1171 }
1172 if (arg == "--cpp_out") {
1173 if (i + 1 >= argc) {
1174 std::fprintf(stderr, "ipc_codegen: --cpp_out requires a directory\n");
1175 return 1;
1176 }
1177 cppOut = argv[++i];
1178 continue;
1179 }
1180 if (!arg.empty() && arg.front() == '-') {
1181 std::fprintf(stderr, "ipc_codegen: unknown option '%s'\n", argv[i]);
1182 printUsage(stderr);
1183 return 1;
1184 }
1185 inputs.emplace_back(arg);
1186 }
1187
1188 if (inputs.empty()) {
1189 printUsage(stderr);
1190 return 1;
1191 }
1192
1193 for (const std::string& input : inputs) {
1194 if (!generate(input, cppOut)) return 1;
1195 }
1196 return 0;
1197}

Callers

nothing calls this directly

Calls 4

printUsageFunction · 0.85
generateFunction · 0.85
sizeMethod · 0.80
emptyMethod · 0.80

Tested by

no test coverage detected