equal
deleted
inserted
replaced
55 else if (value == L"integer") return t::INTEGER; |
55 else if (value == L"integer") return t::INTEGER; |
56 else if (value == L"boolean") return t::BOOLEAN; |
56 else if (value == L"boolean") return t::BOOLEAN; |
57 else throw relpipe::cli::RelpipeCLIException(L"Unable to parse TypeId: " + value, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS); |
57 else throw relpipe::cli::RelpipeCLIException(L"Unable to parse TypeId: " + value, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS); |
58 } |
58 } |
59 |
59 |
|
60 Configuration::ReadTypes parseReadTypes(const relpipe::writer::string_t& value) { |
|
61 if (value == L"auto") return Configuration::ReadTypes::AUTO; |
|
62 else if (value == L"true") return Configuration::ReadTypes::TRUE; |
|
63 else if (value == L"false") return Configuration::ReadTypes::FALSE; |
|
64 else throw relpipe::cli::RelpipeCLIException(L"Unable to parse ReadTypes: " + value, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS); |
|
65 } |
|
66 |
60 public: |
67 public: |
61 |
68 |
62 static const relpipe::writer::string_t OPTION_RELATION; |
69 static const relpipe::writer::string_t OPTION_RELATION; |
63 static const relpipe::writer::string_t OPTION_ATTRIBUTE; |
70 static const relpipe::writer::string_t OPTION_ATTRIBUTE; |
|
71 static const relpipe::writer::string_t OPTION_READ_TYPES; |
64 |
72 |
65 Configuration parse(const std::vector<relpipe::writer::string_t>& arguments) { |
73 Configuration parse(const std::vector<relpipe::writer::string_t>& arguments) { |
66 Configuration c; |
74 Configuration c; |
67 |
75 |
68 for (int i = 0; i < arguments.size();) { |
76 for (int i = 0; i < arguments.size();) { |
73 } else if (option == OPTION_ATTRIBUTE) { |
81 } else if (option == OPTION_ATTRIBUTE) { |
74 AttributeRecipe attribute; |
82 AttributeRecipe attribute; |
75 attribute.name = readNext(arguments, i); |
83 attribute.name = readNext(arguments, i); |
76 attribute.type = parseTypeId(readNext(arguments, i)); |
84 attribute.type = parseTypeId(readNext(arguments, i)); |
77 c.attributes.push_back(attribute); |
85 c.attributes.push_back(attribute); |
|
86 } else if (option == OPTION_READ_TYPES) { |
|
87 c.readTypes = parseReadTypes(readNext(arguments, i)); |
78 } else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS); |
88 } else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS); |
79 } |
89 } |
80 |
90 |
81 return c; |
91 return c; |
82 } |
92 } |
85 } |
95 } |
86 }; |
96 }; |
87 |
97 |
88 const relpipe::writer::string_t CLIParser::OPTION_RELATION = L"--relation"; |
98 const relpipe::writer::string_t CLIParser::OPTION_RELATION = L"--relation"; |
89 const relpipe::writer::string_t CLIParser::OPTION_ATTRIBUTE = L"--attribute"; |
99 const relpipe::writer::string_t CLIParser::OPTION_ATTRIBUTE = L"--attribute"; |
|
100 const relpipe::writer::string_t CLIParser::OPTION_READ_TYPES = L"--read-types"; |
90 |
101 |
91 } |
102 } |
92 } |
103 } |
93 } |
104 } |