src/CLIParser.h
branchv_0
changeset 20 90ae67de2f68
parent 16 15ee963675af
--- a/src/CLIParser.h	Sun Apr 18 10:53:28 2021 +0200
+++ b/src/CLIParser.h	Sun Apr 18 18:20:09 2021 +0200
@@ -57,10 +57,18 @@
 		else throw relpipe::cli::RelpipeCLIException(L"Unable to parse TypeId: " + value, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
 	}
 
+	Configuration::ReadTypes parseReadTypes(const relpipe::writer::string_t& value) {
+		if (value == L"auto") return Configuration::ReadTypes::AUTO;
+		else if (value == L"true") return Configuration::ReadTypes::TRUE;
+		else if (value == L"false") return Configuration::ReadTypes::FALSE;
+		else throw relpipe::cli::RelpipeCLIException(L"Unable to parse ReadTypes: " + value, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
+	}
+
 public:
 
 	static const relpipe::writer::string_t OPTION_RELATION;
 	static const relpipe::writer::string_t OPTION_ATTRIBUTE;
+	static const relpipe::writer::string_t OPTION_READ_TYPES;
 
 	Configuration parse(const std::vector<relpipe::writer::string_t>& arguments) {
 		Configuration c;
@@ -75,6 +83,8 @@
 				attribute.name = readNext(arguments, i);
 				attribute.type = parseTypeId(readNext(arguments, i));
 				c.attributes.push_back(attribute);
+			} else if (option == OPTION_READ_TYPES) {
+				c.readTypes = parseReadTypes(readNext(arguments, i));
 			} else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
 		}
 
@@ -87,6 +97,7 @@
 
 const relpipe::writer::string_t CLIParser::OPTION_RELATION = L"--relation";
 const relpipe::writer::string_t CLIParser::OPTION_ATTRIBUTE = L"--attribute";
+const relpipe::writer::string_t CLIParser::OPTION_READ_TYPES = L"--read-types";
 
 }
 }