diff -r d777064beb32 -r ff69af3c67a3 src/CLIParser.h --- a/src/CLIParser.h Wed Oct 30 16:47:42 2019 +0100 +++ b/src/CLIParser.h Thu Jan 02 23:31:44 2020 +0100 @@ -36,6 +36,15 @@ else throw relpipe::cli::RelpipeCLIException(L"Missing CLI argument" + (i > 0 ? (L" after " + arguments[i - 1]) : L""), relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS); } + /** + * TODO: use a common method + */ + bool parseBoolean(const string_t& value) { + if (value == L"true") return true; + else if (value == L"false") return false; + else throw relpipe::cli::RelpipeCLIException(L"Unable to parse boolean value: " + value + L" (expecting true or false)", relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS); + } + void addRelation(Configuration& c, RelationConfiguration& currentRelation) { if (currentRelation.relation.size()) { c.relationConfigurations.push_back(currentRelation); @@ -58,6 +67,7 @@ static const string_t OPTION_NAME_IS_XPATH; static const string_t OPTION_RECORDS; static const string_t OPTION_ATTRIBUTE; + static const string_t OPTION_XINCLUDE; Configuration parse(const std::vector& arguments) { Configuration c; @@ -69,6 +79,8 @@ if (option == OPTION_NAMESPACE) { c.namespaceMappings.push_back(readNext(arguments, i)); c.namespaceMappings.push_back(readNext(arguments, i)); + } else if (option == OPTION_XINCLUDE) { + c.xinclude = parseBoolean(readNext(arguments, i)); } else if (option == OPTION_RELATION) { addRelation(c, currentRelation); // previous relation currentRelation.relation = readNext(arguments, i); @@ -98,6 +110,7 @@ const string_t CLIParser::OPTION_NAME_IS_XPATH = L"--name-is-xpath"; const string_t CLIParser::OPTION_RECORDS = L"--records"; const string_t CLIParser::OPTION_ATTRIBUTE = L"--attribute"; +const string_t CLIParser::OPTION_XINCLUDE = L"--xinclude"; } }