# HG changeset patch # User František Kučera # Date 1557151617 -7200 # Node ID 6486334a9f9329b880987df15a7fb631790211a4 # Parent dccbfd273a5a25b8022f4b09c37ed688339f3dc7 omit superfluous {} diff -r dccbfd273a5a -r 6486334a9f93 src/CLIParser.h --- a/src/CLIParser.h Wed May 01 22:17:42 2019 +0200 +++ b/src/CLIParser.h Mon May 06 16:06:57 2019 +0200 @@ -72,36 +72,33 @@ 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.guileBeforeRecords = readNext(arguments, i); - else if (option == OPTION_AFTER_RECORDS) currentRelation.guileAfterRecords = readNext(arguments, i); - else if (option == OPTION_FOR_EACH) currentRelation.guileForEach = readNext(arguments, i); - else if (option == OPTION_WHERE) currentRelation.guileWhere = readNext(arguments, i); - else if (option == OPTION_HAS_MORE_RECORDS) currentRelation.guileHasMoreRecords = readNext(arguments, i); - else if (option == OPTION_DROP) currentRelation.drop = true; - 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.guileBeforeRecords = readNext(arguments, i); + else if (option == OPTION_AFTER_RECORDS) currentRelation.guileAfterRecords = readNext(arguments, i); + else if (option == OPTION_FOR_EACH) currentRelation.guileForEach = readNext(arguments, i); + else if (option == OPTION_WHERE) currentRelation.guileWhere = readNext(arguments, i); + else if (option == OPTION_HAS_MORE_RECORDS) currentRelation.guileHasMoreRecords = readNext(arguments, i); + else if (option == OPTION_DROP) currentRelation.drop = true; + 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 }