From 7400a052b7cc71e48deb391cfafcb6a3392ec5e3 Mon Sep 17 00:00:00 2001 From: Paul Colby Date: Fri, 17 Nov 2023 16:36:40 +1100 Subject: [PATCH] Try simplifying the test case --- src/cli/main.cpp | 60 +++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/src/cli/main.cpp b/src/cli/main.cpp index 10701b11a..a8dfc463b 100644 --- a/src/cli/main.cpp +++ b/src/cli/main.cpp @@ -28,7 +28,7 @@ #include #endif -static Q_LOGGING_CATEGORY(lc, "dokit.cli.main", QtInfoMsg); +//static Q_LOGGING_CATEGORY(lc, "dokit.cli.main", QtInfoMsg); inline bool haveConsole() { @@ -311,33 +311,35 @@ int main(int argc, char *argv[]) QCoreApplication::installTranslator(&libTranslator); } - // Parse the command line. - const QStringList appArguments = QCoreApplication::arguments(); - QCommandLineParser parser; - const Command commandType = parseCommandLine(appArguments, parser); - qCDebug(lc).noquote() << QCoreApplication::applicationName() << QCoreApplication::applicationVersion(); - qCDebug(lc).noquote() << "Qt" << qVersion() << "(runtime) [" QT_VERSION_STR " compile-time]"; -#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) // QTranslator::filePath() added in Qt 5.15. - qCDebug(lc).noquote() << "App translations:" << - (appTranslator.filePath().isEmpty() ? QStringLiteral("") : appTranslator.filePath()); - qCDebug(lc).noquote() << "Library translations:" << - (libTranslator.filePath().isEmpty() ? QStringLiteral("") : libTranslator.filePath()); -#else - qCDebug(lc).noquote() << "App translations:" << (!appTranslator.isEmpty()); - qCDebug(lc).noquote() << "Lib translations:" << (!libTranslator.isEmpty()); -#endif + return 0; - // Handle the given command. - AbstractCommand * const command = getCommandObject(commandType, &app); - if (command == nullptr) { - return EXIT_FAILURE; // getCommandObject will have logged the reason already. - } - const QStringList cliErrors = command->processOptions(parser); - for (const QString &error: cliErrors) { - showCliError(error); - } - if (!cliErrors.isEmpty()) { - return EXIT_FAILURE; - } - return (command->start()) ? QCoreApplication::exec() : EXIT_FAILURE; +// // Parse the command line. +// const QStringList appArguments = QCoreApplication::arguments(); +// QCommandLineParser parser; +// const Command commandType = parseCommandLine(appArguments, parser); +// qCDebug(lc).noquote() << QCoreApplication::applicationName() << QCoreApplication::applicationVersion(); +// qCDebug(lc).noquote() << "Qt" << qVersion() << "(runtime) [" QT_VERSION_STR " compile-time]"; +//#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) // QTranslator::filePath() added in Qt 5.15. +// qCDebug(lc).noquote() << "App translations:" << +// (appTranslator.filePath().isEmpty() ? QStringLiteral("") : appTranslator.filePath()); +// qCDebug(lc).noquote() << "Library translations:" << +// (libTranslator.filePath().isEmpty() ? QStringLiteral("") : libTranslator.filePath()); +//#else +// qCDebug(lc).noquote() << "App translations:" << (!appTranslator.isEmpty()); +// qCDebug(lc).noquote() << "Lib translations:" << (!libTranslator.isEmpty()); +//#endif + +// // Handle the given command. +// AbstractCommand * const command = getCommandObject(commandType, &app); +// if (command == nullptr) { +// return EXIT_FAILURE; // getCommandObject will have logged the reason already. +// } +// const QStringList cliErrors = command->processOptions(parser); +// for (const QString &error: cliErrors) { +// showCliError(error); +// } +// if (!cliErrors.isEmpty()) { +// return EXIT_FAILURE; +// } +// return (command->start()) ? QCoreApplication::exec() : EXIT_FAILURE; }