| 272 | }; |
| 273 | |
| 274 | int main(int argc, char *argv[]) |
| 275 | { |
| 276 | ConfigOptionString extractList( |
| 277 | "Extractor", "extract", |
| 278 | "Comma-separated list of things to extract - \"all\" is special meaning everything", |
| 279 | "all"); |
| 280 | |
| 281 | if (config().parseOptions(argc, argv)) |
| 282 | { |
| 283 | return EXIT_FAILURE; |
| 284 | } |
| 285 | auto extractListString = extractList.get(); |
| 286 | |
| 287 | std::list<std::pair<UString, std::function<void(const InitialGameStateExtractor &e)>>> |
| 288 | extractorsToRun; |
| 289 | |
| 290 | if (extractListString == "all") |
| 291 | { |
| 292 | LogWarning("Running all extractors"); |
| 293 | for (auto &ePair : thingsToExtract) |
| 294 | { |
| 295 | extractorsToRun.push_back(ePair); |
| 296 | } |
| 297 | } |
| 298 | else |
| 299 | { |
| 300 | auto list = split(extractListString, ","); |
| 301 | for (auto &extractorName : list) |
| 302 | { |
| 303 | auto extractor = thingsToExtract.find(extractorName); |
| 304 | if (extractor == thingsToExtract.end()) |
| 305 | { |
| 306 | LogError("Unknown extractor %s", extractorName); |
| 307 | return EXIT_FAILURE; |
| 308 | } |
| 309 | else |
| 310 | { |
| 311 | extractorsToRun.push_back(*extractor); |
| 312 | } |
| 313 | } |
| 314 | } |
| 315 | Framework fw(UString(argv[0]), false); |
| 316 | InitialGameStateExtractor initialGameStateExtractor; |
| 317 | for (auto &ePair : extractorsToRun) |
| 318 | { |
| 319 | LogWarning("Running %s", ePair.first); |
| 320 | ePair.second(initialGameStateExtractor); |
| 321 | } |
| 322 | |
| 323 | return 0; |
| 324 | } |
nothing calls this directly
no test coverage detected