| 233 | } |
| 234 | |
| 235 | static 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 | } |
| 273 | static int runTest(Options const& opts) |
| 274 | { |
| 275 | int exitCode = 0; |
no test coverage detected