--- a/src/CLIParser.h Mon Oct 26 00:00:35 2020 +0100
+++ b/src/CLIParser.h Sun May 09 18:19:09 2021 +0200
@@ -38,6 +38,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 addQuery(Configuration& c, Statement& currentQuery) {
if (currentQuery.sql.size()) {
c.statements.push_back(currentQuery);
@@ -85,7 +94,7 @@
} else if (option == OPTION_DATA_SOURCE_STRING) {
c.dataSourceString = readNext(arguments, i);
} else if (option == OPTION_LIST_DATA_SOURCES) {
- c.listDataSources = true;
+ c.listDataSources = parseBoolean(readNext(arguments, i));
} else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
}
addQuery(c, currentQuery); // last relation