From c4d09eb2ea2a76f30060b89f04e43612933f3976 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Thu, 6 Jul 2023 16:54:01 +0200 Subject: [PATCH] Add -e (execute-script-only) and -d (dry-run) options --- main.cpp | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/main.cpp b/main.cpp index fee9594..6bb03ce 100644 --- a/main.cpp +++ b/main.cpp @@ -88,16 +88,24 @@ int main(int argc, char *argv[]) { workingDirectoryOption.setDefaultValue(workingDirectoryDefault); parser.addOption(workingDirectoryOption); - QCommandLineOption maintenanceOption("m", + QCommandLineOption maintenanceOption(QStringList() << "m" << "maintenance", QCoreApplication::translate("main", "Maintenance mode for underlying script")); parser.addOption(maintenanceOption); // test-mode: edit the file update_log.csv and execute the commands // contained in it. Do not call the update-script. - QCommandLineOption testOption("t", + QCommandLineOption testOption(QStringList() << "t" << "test", QCoreApplication::translate("main", "Test mode for ATBUpdateTool")); parser.addOption(testOption); + QCommandLineOption execScriptOption(QStringList() << "e" << "execute-script-only", + QCoreApplication::translate("main", "ATBUpdateTool executes update-script only. No download of any files.")); + parser.addOption(execScriptOption); + + QCommandLineOption dryRunOption(QStringList() << "d" << "dry-run", + QCoreApplication::translate("main", "Start ATBUpdateTool in dry-run-mode. No actual actions.")); + parser.addOption(dryRunOption); + // TODO: // add some additional parameters // --dry-run @@ -113,6 +121,8 @@ int main(int argc, char *argv[]) { QString workingDir = parser.value(workingDirectoryOption); bool maintenanceMode = parser.isSet(maintenanceOption); bool testMode = parser.isSet(testOption); + bool executeScriptOnly = parser.isSet(execScriptOption); + bool dryRun = parser.isSet(dryRunOption); QString const rtPath = QCoreApplication::applicationDirPath(); if (plugInDir == pluginDefault) { @@ -123,12 +133,15 @@ int main(int argc, char *argv[]) { << "does not exists, but has to contain dc-library"; exit(-1); } - qInfo() << "pwd" << "=" << rtPath; - qInfo() << "plugInDir" << "=" << plugInDir; - qInfo() << "plugInName" << "=" << plugInName; - qInfo() << "workingDir" << "=" << workingDir; - qInfo() << "maintenanceMode" << "=" << maintenanceMode; - qInfo() << "testMode" << "=" << testMode; + + qInfo() << "pwd ..............." << rtPath; + qInfo() << "plugInDir ........." << plugInDir; + qInfo() << "plugInName ........" << plugInName; + qInfo() << "workingDir ........" << workingDir; + qInfo() << "maintenanceMode ..." << maintenanceMode; + qInfo() << "testMode .........." << testMode; + qInfo() << "execScriptOnly ...." << executeScriptOnly; + qInfo() << "dryRun ............" << dryRun; // before loading the library, delete all possible shared memory segments #if defined Q_OS_LINUX || defined Q_OS_UNIX