From acec41685ed589bc661d0df68b3fcb18bb8319c2 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 18 Oct 2020 22:56:54 +0200 Subject: [PATCH] Do error-handling ourselves in argument parsing. This means we only print a warning on unhandled options instead of exiting the application. --- src/common/Args.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/common/Args.cpp b/src/common/Args.cpp index 15e151ca5..0c48d52e0 100644 --- a/src/common/Args.cpp +++ b/src/common/Args.cpp @@ -30,7 +30,18 @@ Args::Args(const QApplication &app) "specify platform. Only twitch channels are supported at the moment.\n" "If platform isn't specified, default is Twitch.", "t:channel1;t:channel2;...")); - parser.process(app); + + if (!parser.parse(app.arguments())) + { + qDebug() << "Warning: Unhandled options:" + << parser.unknownOptionNames(); + } + + if (parser.isSet("help")) + { + qDebug().noquote() << parser.helpText(); + ::exit(EXIT_SUCCESS); + } const QStringList args = parser.positionalArguments(); this->shouldRunBrowserExtensionHost =