--- a/src/CLIParser.h Mon May 06 16:00:20 2019 +0200
+++ b/src/CLIParser.h Mon May 06 16:06:57 2019 +0200
@@ -73,33 +73,30 @@
Configuration c;
RelationConfiguration currentRelation;
- {
- for (int i = 0; i < arguments.size();) {
- string_t option = readNext(arguments, i);
+ for (int i = 0; i < arguments.size();) {
+ string_t option = readNext(arguments, i);
- if (option == OPTION_BEFORE_RECORDS) currentRelation.awkBeforeRecords = readNext(arguments, i);
- else if (option == OPTION_AFTER_RECORDS) currentRelation.awkAfterRecords = readNext(arguments, i);
- else if (option == OPTION_FOR_EACH) currentRelation.awkForEach = readNext(arguments, i);
- else if (option == OPTION_INPUT_ATTRIBUTES_APPEND) currentRelation.inputAttributesAppend = true;
- else if (option == OPTION_INPUT_ATTRIBUTES_PREPEND) currentRelation.inputAttributesPrepend = true;
- else if (option == OPTION_RELATION) {
- addRelation(c, currentRelation); // previous relation
- currentRelation.relation = readNext(arguments, i);
- } else if (option == OPTION_OUTPUT_ATTRIBUTE) {
- relpipe::writer::AttributeMetadata attribute;
- attribute.attributeName = readNext(arguments, i);
- attribute.typeId = parseTypeId(readNext(arguments, i));
- currentRelation.writerMetadata.push_back(attribute);
- } else if (option == OPTION_DEFINE) {
- DefinitionRecipe definition;
- definition.name = readNext(arguments, i);
- definition.type = readNext(arguments, i);
- definition.value = readNext(arguments, i);
- if (currentRelation.relation.size()) currentRelation.definitions.push_back(definition);
- else c.definitions.push_back(definition);
- } else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
-
- }
+ if (option == OPTION_BEFORE_RECORDS) currentRelation.awkBeforeRecords = readNext(arguments, i);
+ else if (option == OPTION_AFTER_RECORDS) currentRelation.awkAfterRecords = readNext(arguments, i);
+ else if (option == OPTION_FOR_EACH) currentRelation.awkForEach = readNext(arguments, i);
+ else if (option == OPTION_INPUT_ATTRIBUTES_APPEND) currentRelation.inputAttributesAppend = true;
+ else if (option == OPTION_INPUT_ATTRIBUTES_PREPEND) currentRelation.inputAttributesPrepend = true;
+ else if (option == OPTION_RELATION) {
+ addRelation(c, currentRelation); // previous relation
+ currentRelation.relation = readNext(arguments, i);
+ } else if (option == OPTION_OUTPUT_ATTRIBUTE) {
+ relpipe::writer::AttributeMetadata attribute;
+ attribute.attributeName = readNext(arguments, i);
+ attribute.typeId = parseTypeId(readNext(arguments, i));
+ currentRelation.writerMetadata.push_back(attribute);
+ } else if (option == OPTION_DEFINE) {
+ DefinitionRecipe definition;
+ definition.name = readNext(arguments, i);
+ definition.type = readNext(arguments, i);
+ definition.value = readNext(arguments, i);
+ if (currentRelation.relation.size()) currentRelation.definitions.push_back(definition);
+ else c.definitions.push_back(definition);
+ } else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
addRelation(c, currentRelation); // last relation
}