| 535 | } |
| 536 | |
| 537 | bool applyTargetConfiguration(TagTarget &target, std::string_view configStr) |
| 538 | { |
| 539 | if (!configStr.empty()) { |
| 540 | if (configStr.compare(0, 13, "target-level=") == 0) { |
| 541 | try { |
| 542 | target.setLevel(stringToNumber<std::uint64_t>(configStr.substr(13))); |
| 543 | } catch (const ConversionException &) { |
| 544 | cerr << Phrases::Error << "The specified target level \"" << configStr.substr(13) << "\" is invalid." << Phrases::End |
| 545 | << "note: The target level must be an unsigned integer." << endl; |
| 546 | exit(-1); |
| 547 | } |
| 548 | } else if (configStr.compare(0, 17, "target-levelname=") == 0) { |
| 549 | target.setLevelName(std::string(configStr.substr(17))); |
| 550 | } else if (configStr.compare(0, 14, "target-tracks=") == 0) { |
| 551 | target.tracks() = parseIds(configStr.substr(14)); |
| 552 | } else if (configStr.compare(0, 16, "target-chapters=") == 0) { |
| 553 | target.chapters() = parseIds(configStr.substr(16)); |
| 554 | } else if (configStr.compare(0, 16, "target-editions=") == 0) { |
| 555 | target.editions() = parseIds(configStr.substr(16)); |
| 556 | } else if (configStr.compare(0, 19, "target-attachments=") == 0) { |
| 557 | target.attachments() = parseIds(configStr.substr(19)); |
| 558 | } else if (configStr.compare(0, 13, "target-reset=") == 0) { |
| 559 | if (*(configStr.data() + 13)) { |
| 560 | cerr << Phrases::Error << "Invalid assignment " << (configStr.data() + 13) << " for target-reset." << Phrases::EndFlush; |
| 561 | exit(-1); |
| 562 | } |
| 563 | target.clear(); |
| 564 | } else if (configStr == "target-reset") { |
| 565 | target.clear(); |
| 566 | } else { |
| 567 | return false; |
| 568 | } |
| 569 | return true; |
| 570 | } else { |
| 571 | return false; |
| 572 | } |
| 573 | } |
| 574 | |
| 575 | FieldDenotations parseFieldDenotations(const Argument &fieldsArg, bool readOnly) |
| 576 | { |
no test coverage detected