aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 1b4d26f..52df7ac 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -25,24 +25,8 @@ int main(int argc, char **argv)
std::shared_ptr<Configuration> config = std::make_shared<Configuration>();
config->read(parser.value(parser.configOption));
- // parse command-line overrides
- // we assume the users knows what they're doing, so we only pass the unknown options to program_options
- // passing any unknown options though will cause it to fail, so we need to filter out the regular options
- // unfortunately, QCommandLineParser will only give us the unknown option
- // names, so we need to build a list, add them as options, reparse, and then
- // we get their values
- if(!parser.unknownOptions.isEmpty()) {
- int _argc = parser.unknownOptions.length() + 1;
- const char *_argv[_argc];
-
- // program_options requires 0 to be the program name, otherwise it seems to fail
- _argv[0] = qUtf8Printable(app.arguments().at(0));
-
- for(int i = 1; i < _argc; ++i) {
- _argv[i] = qUtf8Printable(QString("--%1=%2").arg(parser.unknownOptions[i - 1].names().at(0), parser.value(parser.unknownOptions[i - 1])));
- }
-
- config->parse(_argc, _argv);
+ if(!parser.unknownOptionNames().isEmpty()) {
+ qDebug("config->parse: %s", config->parse(argc, argv) ? "true" : "false");
}
app.setConfiguration(config);