Improve command line version info and help display to streamline gui and cmd
authorMichael Schuster <michael@schuster.ms>
Sat, 6 Jun 2020 18:04:48 +0000 (20:04 +0200)
committerMichael Schuster <michael@schuster.ms>
Sun, 7 Jun 2020 12:20:33 +0000 (14:20 +0200)
Signed-off-by: Michael Schuster <michael@schuster.ms>
src/gui/application.cpp
src/libsync/theme.cpp

index be5c098fe618e98a2ed34a3461fe2acf6dd4cdb3..65539b9b5c84842bc24cc2c0d9ffafa4e3ad5acc 100644 (file)
@@ -68,9 +68,9 @@ namespace {
 
     static const char optionsC[] =
         "Options:\n"
-        "  -h --help            : show this help screen.\n"
-        "  --version            : show version information.\n"
-        "  --logwindow          : open a window to show log output.\n"
+        "  --help, -h           : show this help screen.\n"
+        "  --version, -v        : show version information.\n"
+        "  --logwindow, -l      : open a window to show log output.\n"
         "  --logfile <filename> : write log output to file <filename>.\n"
         "  --logdir <name>      : write each sync log output in a new file\n"
         "                         in folder <name>.\n"
@@ -495,7 +495,7 @@ void Application::parseOptions(const QStringList &options)
             _debugMode = true;
         } else if (option == QLatin1String("--background")) {
             _backgroundMode = true;
-        } else if (option == QLatin1String("--version")) {
+        } else if (option == QLatin1String("--version") || option == QLatin1String("-v")) {
             _versionOnly = true;
         } else {
             showHint("Unrecognized option '" + option.toStdString() + "'");
index 5ad0c4363ecd53024ff479ae3beaa9080a68e707..6e0e2760ffc4c4db53e62b5de55416d698f06045 100644 (file)
@@ -565,7 +565,10 @@ QString Theme::versionSwitchOutput() const
     stream << "Git revision " << GIT_SHA1 << endl;
 #endif
     stream << "Using Qt " << qVersion() << ", built against Qt " << QT_VERSION_STR << endl;
-    stream << "Using Qt platform plugin '" << QGuiApplication::platformName() << "'" << endl;
+
+    if(!QGuiApplication::platformName().isEmpty())
+        stream << "Using Qt platform plugin '" << QGuiApplication::platformName() << "'" << endl;
+
     stream << "Using '" << QSslSocket::sslLibraryVersionString() << "'" << endl;
     stream << "Running on " << Utility::platformName() << ", " << QSysInfo::currentCpuArchitecture() << endl;
     return helpText;