MCPcopy Create free account
hub / github.com/ComodoSecurity/openedr / parseCommandLine

Function parseCommandLine

edrav2/eprj/jsoncpp/src/jsontestrunner/main.cpp:209–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207}
208
209static int parseCommandLine(int argc, const char* argv[], Options* opts) {
210 opts->parseOnly = false;
211 opts->write = &useStyledWriter;
212 if (argc < 2) {
213 return printUsage(argv);
214 }
215 int index = 1;
216 if (JSONCPP_STRING(argv[index]) == "--json-checker") {
217 opts->features = Json::Features::strictMode();
218 opts->parseOnly = true;
219 ++index;
220 }
221 if (JSONCPP_STRING(argv[index]) == "--json-config") {
222 printConfig();
223 return 3;
224 }
225 if (JSONCPP_STRING(argv[index]) == "--json-writer") {
226 ++index;
227 JSONCPP_STRING const writerName(argv[index++]);
228 if (writerName == "StyledWriter") {
229 opts->write = &useStyledWriter;
230 } else if (writerName == "StyledStreamWriter") {
231 opts->write = &useStyledStreamWriter;
232 } else if (writerName == "BuiltStyledStreamWriter") {
233 opts->write = &useBuiltStyledStreamWriter;
234 } else {
235 printf("Unknown '--json-writer %s'\n", writerName.c_str());
236 return 4;
237 }
238 }
239 if (index == argc || index + 1 < argc) {
240 return printUsage(argv);
241 }
242 opts->path = argv[index];
243 return 0;
244}
245static int runTest(Options const& opts) {
246 int exitCode = 0;
247

Callers 1

mainFunction · 0.85

Calls 4

printUsageFunction · 0.85
printConfigFunction · 0.85
printfClass · 0.85
c_strMethod · 0.45

Tested by

no test coverage detected