| 426 | } |
| 427 | |
| 428 | static bool ParseShortOption( |
| 429 | const CommandLineOptionDefinition* options, CommandLineArgEnumerator* argEnumerator, const char* argument) |
| 430 | { |
| 431 | const CommandLineOptionDefinition* option = nullptr; |
| 432 | |
| 433 | const char* shortOption = &argument[1]; |
| 434 | for (; *shortOption != '\0'; shortOption++) |
| 435 | { |
| 436 | option = FindOption(options, shortOption[0]); |
| 437 | if (option == nullptr) |
| 438 | { |
| 439 | Console::Error::WriteLine("Unknown option: -%c", shortOption[0]); |
| 440 | return false; |
| 441 | } |
| 442 | if (option->Type == CMDLINE_TYPE_SWITCH) |
| 443 | { |
| 444 | if (!ParseOptionValue(option, nullptr)) |
| 445 | { |
| 446 | return false; |
| 447 | } |
| 448 | } |
| 449 | else if (shortOption[1] != '\0') |
| 450 | { |
| 451 | return ParseOptionValue(option, &shortOption[1]); |
| 452 | } |
| 453 | } |
| 454 | |
| 455 | if (option != nullptr && option->Type != CMDLINE_TYPE_SWITCH) |
| 456 | { |
| 457 | const char* valueString = nullptr; |
| 458 | if (!argEnumerator->TryPopString(&valueString)) |
| 459 | { |
| 460 | Console::Error::WriteLine("Expected value for option: %c", option->ShortName); |
| 461 | return false; |
| 462 | } |
| 463 | |
| 464 | if (!ParseOptionValue(option, valueString)) |
| 465 | { |
| 466 | return false; |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | return true; |
| 471 | } |
| 472 | |
| 473 | static bool ParseOptionValue(const CommandLineOptionDefinition* option, const char* valueString) |
| 474 | { |
no test coverage detected