Add -e (execute-script-only) and -d (dry-run) options
This commit is contained in:
parent
3039fcc553
commit
c4d09eb2ea
29
main.cpp
29
main.cpp
@ -88,16 +88,24 @@ int main(int argc, char *argv[]) {
|
|||||||
workingDirectoryOption.setDefaultValue(workingDirectoryDefault);
|
workingDirectoryOption.setDefaultValue(workingDirectoryDefault);
|
||||||
parser.addOption(workingDirectoryOption);
|
parser.addOption(workingDirectoryOption);
|
||||||
|
|
||||||
QCommandLineOption maintenanceOption("m",
|
QCommandLineOption maintenanceOption(QStringList() << "m" << "maintenance",
|
||||||
QCoreApplication::translate("main", "Maintenance mode for underlying script"));
|
QCoreApplication::translate("main", "Maintenance mode for underlying script"));
|
||||||
parser.addOption(maintenanceOption);
|
parser.addOption(maintenanceOption);
|
||||||
|
|
||||||
// test-mode: edit the file update_log.csv and execute the commands
|
// test-mode: edit the file update_log.csv and execute the commands
|
||||||
// contained in it. Do not call the update-script.
|
// contained in it. Do not call the update-script.
|
||||||
QCommandLineOption testOption("t",
|
QCommandLineOption testOption(QStringList() << "t" << "test",
|
||||||
QCoreApplication::translate("main", "Test mode for ATBUpdateTool"));
|
QCoreApplication::translate("main", "Test mode for ATBUpdateTool"));
|
||||||
parser.addOption(testOption);
|
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:
|
// TODO:
|
||||||
// add some additional parameters
|
// add some additional parameters
|
||||||
// --dry-run
|
// --dry-run
|
||||||
@ -113,6 +121,8 @@ int main(int argc, char *argv[]) {
|
|||||||
QString workingDir = parser.value(workingDirectoryOption);
|
QString workingDir = parser.value(workingDirectoryOption);
|
||||||
bool maintenanceMode = parser.isSet(maintenanceOption);
|
bool maintenanceMode = parser.isSet(maintenanceOption);
|
||||||
bool testMode = parser.isSet(testOption);
|
bool testMode = parser.isSet(testOption);
|
||||||
|
bool executeScriptOnly = parser.isSet(execScriptOption);
|
||||||
|
bool dryRun = parser.isSet(dryRunOption);
|
||||||
QString const rtPath = QCoreApplication::applicationDirPath();
|
QString const rtPath = QCoreApplication::applicationDirPath();
|
||||||
|
|
||||||
if (plugInDir == pluginDefault) {
|
if (plugInDir == pluginDefault) {
|
||||||
@ -123,12 +133,15 @@ int main(int argc, char *argv[]) {
|
|||||||
<< "does not exists, but has to contain dc-library";
|
<< "does not exists, but has to contain dc-library";
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
qInfo() << "pwd" << "=" << rtPath;
|
|
||||||
qInfo() << "plugInDir" << "=" << plugInDir;
|
qInfo() << "pwd ..............." << rtPath;
|
||||||
qInfo() << "plugInName" << "=" << plugInName;
|
qInfo() << "plugInDir ........." << plugInDir;
|
||||||
qInfo() << "workingDir" << "=" << workingDir;
|
qInfo() << "plugInName ........" << plugInName;
|
||||||
qInfo() << "maintenanceMode" << "=" << maintenanceMode;
|
qInfo() << "workingDir ........" << workingDir;
|
||||||
qInfo() << "testMode" << "=" << testMode;
|
qInfo() << "maintenanceMode ..." << maintenanceMode;
|
||||||
|
qInfo() << "testMode .........." << testMode;
|
||||||
|
qInfo() << "execScriptOnly ...." << executeScriptOnly;
|
||||||
|
qInfo() << "dryRun ............" << dryRun;
|
||||||
|
|
||||||
// before loading the library, delete all possible shared memory segments
|
// before loading the library, delete all possible shared memory segments
|
||||||
#if defined Q_OS_LINUX || defined Q_OS_UNIX
|
#if defined Q_OS_LINUX || defined Q_OS_UNIX
|
||||||
|
Loading…
Reference in New Issue
Block a user