Integrate call parameter -V (= --extended-version) to show extended

version (including last git commit)
This commit is contained in:
Gerhard Hoffmann 2023-10-12 12:12:16 +02:00
parent 3a83efbd3f
commit 53639b55c9

View File

@ -112,14 +112,24 @@ int main(int argc, char *argv[]) {
QCoreApplication::translate("main", "Start ATBUpdateTool in dry-run-mode. No actual actions.")); QCoreApplication::translate("main", "Start ATBUpdateTool in dry-run-mode. No actual actions."));
parser.addOption(dryRunOption); parser.addOption(dryRunOption);
QCommandLineOption extendedVersionOption(QStringList() << "V" << "extended-version",
QCoreApplication::translate("main", "Show extended version (including last git commit)."));
parser.addOption(extendedVersionOption);
// Process the actual command line arguments given by the user // Process the actual command line arguments given by the user
parser.process(a); parser.process(a);
QString plugInDir = parser.value(pluginDirectoryOption); QString plugInDir = parser.value(pluginDirectoryOption);
QString plugInName = parser.value(pluginNameOption); QString plugInName = parser.value(pluginNameOption);
QString workingDir = parser.value(workingDirectoryOption); QString workingDir = parser.value(workingDirectoryOption);
bool dryRun = parser.isSet(dryRunOption); bool const dryRun = parser.isSet(dryRunOption);
bool const showExtendedVersion = parser.isSet(extendedVersionOption);
QString const rtPath = QCoreApplication::applicationDirPath(); QString const rtPath = QCoreApplication::applicationDirPath();
if (showExtendedVersion) {
printf(APP_EXTENDED_VERSION"\n");
return 0;
}
if (!QDir(plugInDir).exists()) { if (!QDir(plugInDir).exists()) {
qCritical() << plugInDir qCritical() << plugInDir
<< "does not exists, but has to contain dc-library"; << "does not exists, but has to contain dc-library";