97 } else if (option == OPTION_RECORD) { |
97 } else if (option == OPTION_RECORD) { |
98 readNextRecord(arguments, i, currentRelation); |
98 readNextRecord(arguments, i, currentRelation); |
99 } else if (option == OPTION_RECORDS) { |
99 } else if (option == OPTION_RECORDS) { |
100 while (i < arguments.size()) readNextRecord(arguments, i, currentRelation); |
100 while (i < arguments.size()) readNextRecord(arguments, i, currentRelation); |
101 } else if (option == OPTION_RECORDS_STDIN) { |
101 } else if (option == OPTION_RECORDS_STDIN) { |
102 for (RelationConfiguration r : c.relationConfigurations) if (r.valueStream) throw relpipe::cli::RelpipeCLIException(L"Only one relation can read data from STDIN.", relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS); |
102 if (parseBoolean(readNext(arguments, i))) { |
103 currentRelation.valueStream = &std::cin; |
103 for (RelationConfiguration r : c.relationConfigurations) if (r.valueStream) throw relpipe::cli::RelpipeCLIException(L"Only one relation can read data from STDIN.", relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS); |
|
104 currentRelation.valueStream = &std::cin; |
|
105 } |
104 } else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS); |
106 } else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS); |
105 } |
107 } |
106 addRelation(c, currentRelation); // last relation |
108 addRelation(c, currentRelation); // last relation |
107 |
109 |
108 return c; |
110 return c; |
115 const relpipe::writer::string_t CLIParser::OPTION_RELATION = L"--relation"; |
117 const relpipe::writer::string_t CLIParser::OPTION_RELATION = L"--relation"; |
116 const relpipe::writer::string_t CLIParser::OPTION_WRITE_HEADER = L"--write-header"; |
118 const relpipe::writer::string_t CLIParser::OPTION_WRITE_HEADER = L"--write-header"; |
117 const relpipe::writer::string_t CLIParser::OPTION_ATTRIBUTE = L"--attribute"; |
119 const relpipe::writer::string_t CLIParser::OPTION_ATTRIBUTE = L"--attribute"; |
118 const relpipe::writer::string_t CLIParser::OPTION_RECORD = L"--record"; |
120 const relpipe::writer::string_t CLIParser::OPTION_RECORD = L"--record"; |
119 const relpipe::writer::string_t CLIParser::OPTION_RECORDS = L"--records"; |
121 const relpipe::writer::string_t CLIParser::OPTION_RECORDS = L"--records"; |
120 const relpipe::writer::string_t CLIParser::OPTION_RECORDS_STDIN = L"--records-from-stdin"; |
122 const relpipe::writer::string_t CLIParser::OPTION_RECORDS_STDIN = L"--records-on-stdin"; |
121 |
123 |
122 } |
124 } |
123 } |
125 } |
124 } |
126 } |