| 207 | } |
| 208 | |
| 209 | static 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 | } |
| 245 | static int runTest(Options const& opts) { |
| 246 | int exitCode = 0; |
| 247 |
no test coverage detected