diff options
Diffstat (limited to 'src/app/config-ui/main.cpp')
-rw-r--r-- | src/app/config-ui/main.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/app/config-ui/main.cpp b/src/app/config-ui/main.cpp index b11042b72..6515ec227 100644 --- a/src/app/config-ui/main.cpp +++ b/src/app/config-ui/main.cpp @@ -28,29 +28,31 @@ ****************************************************************************/ #include "mainwindow.h" -#include "../shared/logging/consolelogger.h" -#include "../shared/qbssettings.h" +#include "commandlineparser.h" #include <logging/translator.h> +#include <tools/error.h> #include <QApplication> #include <cstdlib> +#include <iostream> using qbs::Internal::Tr; int main(int argc, char *argv[]) { QApplication app(argc, argv); - SettingsPtr settings = qbsSettings(); - ConsoleLogger::instance(settings.data()); - const QStringList args = app.arguments().mid(1); - if (args.count() == 1 && - (args.first() == QLatin1String("--help") || args.first() == QLatin1String("-h"))) { - qbsInfo() << Tr::tr("This tool displays qbs settings in a GUI.\n" - "If you have more than a few settings, this might be preferable to " - "plain \"qbs config\", as it presents a hierarchical view."); - return EXIT_SUCCESS; + CommandLineParser clParser; + try { + clParser.parse(app.arguments()); + if (clParser.helpRequested()) { + std::cout << qPrintable(clParser.usageString()); + return EXIT_SUCCESS; + } + } catch (const qbs::ErrorInfo &error) { + std::cerr << qPrintable(error.toString()); + return EXIT_FAILURE; } MainWindow mw; |