Add -e (execute-script-only) and -d (dry-run) options

This commit is contained in:
Gerhard Hoffmann 2023-07-06 16:54:01 +02:00
parent 3039fcc553
commit c4d09eb2ea

View File

@ -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