MCPcopy Create free account
hub / github.com/SOUI2/soui / parseCommandLine

Function parseCommandLine

third-part/jsoncpp/src/jsontestrunner/main.cpp:235–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233}
234
235static int parseCommandLine(
236 int argc, const char* argv[], Options* opts)
237{
238 opts->parseOnly = false;
239 opts->write = &useStyledWriter;
240 if (argc < 2) {
241 return printUsage(argv);
242 }
243 int index = 1;
244 if (JSONCPP_STRING(argv[index]) == "--json-checker") {
245 opts->features = Json::Features::strictMode();
246 opts->parseOnly = true;
247 ++index;
248 }
249 if (JSONCPP_STRING(argv[index]) == "--json-config") {
250 printConfig();
251 return 3;
252 }
253 if (JSONCPP_STRING(argv[index]) == "--json-writer") {
254 ++index;
255 JSONCPP_STRING const writerName(argv[index++]);
256 if (writerName == "StyledWriter") {
257 opts->write = &useStyledWriter;
258 } else if (writerName == "StyledStreamWriter") {
259 opts->write = &useStyledStreamWriter;
260 } else if (writerName == "BuiltStyledStreamWriter") {
261 opts->write = &useBuiltStyledStreamWriter;
262 } else {
263 printf("Unknown '--json-writer %s'\n", writerName.c_str());
264 return 4;
265 }
266 }
267 if (index == argc || index + 1 < argc) {
268 return printUsage(argv);
269 }
270 opts->path = argv[index];
271 return 0;
272}
273static int runTest(Options const& opts)
274{
275 int exitCode = 0;

Callers 1

mainFunction · 0.85

Calls 3

printConfigFunction · 0.85
printUsageFunction · 0.70
c_strMethod · 0.45

Tested by

no test coverage detected