add command-line parameter "debug"
This commit is contained in:
@@ -67,11 +67,11 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
//return 0;
|
//return 0;
|
||||||
|
|
||||||
/*
|
|
||||||
CommandLineParser parser;
|
CommandLineParser parser;
|
||||||
parser.process(a);
|
parser.process(a);
|
||||||
parser.readSettings();
|
parser.readSettings();
|
||||||
|
|
||||||
|
/*
|
||||||
QString repositoryUrl = parser.repositoryUrl();
|
QString repositoryUrl = parser.repositoryUrl();
|
||||||
QString plugInDir = parser.plugInDir();
|
QString plugInDir = parser.plugInDir();
|
||||||
QString plugInName = parser.plugInName();
|
QString plugInName = parser.plugInName();
|
||||||
@@ -80,6 +80,7 @@ int main(int argc, char **argv) {
|
|||||||
QString psaTariffDir = parser.psaTariffDir();
|
QString psaTariffDir = parser.psaTariffDir();
|
||||||
QString psaDcDir = parser.dcDir();
|
QString psaDcDir = parser.dcDir();
|
||||||
QString iniFileName = parser.iniFileName();
|
QString iniFileName = parser.iniFileName();
|
||||||
|
bool debug = parser.debug();
|
||||||
bool const dryRun = parser.dryRun();
|
bool const dryRun = parser.dryRun();
|
||||||
bool const noUpdatePsaHardware = parser.noUpdatePsaHardware();
|
bool const noUpdatePsaHardware = parser.noUpdatePsaHardware();
|
||||||
bool const showYoctoVersion = parser.yoctoVersion();
|
bool const showYoctoVersion = parser.yoctoVersion();
|
||||||
|
@@ -23,6 +23,7 @@ class CommandLineParser : public QCommandLineParser {
|
|||||||
QString m_alwaysDownloadDC;
|
QString m_alwaysDownloadDC;
|
||||||
QString m_readDCVersion{"false"};
|
QString m_readDCVersion{"false"};
|
||||||
QString m_dcDir{"etc/dc/"};
|
QString m_dcDir{"etc/dc/"};
|
||||||
|
QString m_debug{"false"};
|
||||||
qint64 m_ppid;
|
qint64 m_ppid;
|
||||||
|
|
||||||
QCommandLineOption m_repositoryUrlOption;
|
QCommandLineOption m_repositoryUrlOption;
|
||||||
@@ -43,6 +44,7 @@ class CommandLineParser : public QCommandLineParser {
|
|||||||
QCommandLineOption m_dcDirectoryOption;
|
QCommandLineOption m_dcDirectoryOption;
|
||||||
QCommandLineOption m_readDCVersionOption;
|
QCommandLineOption m_readDCVersionOption;
|
||||||
QCommandLineOption m_setPPid;
|
QCommandLineOption m_setPPid;
|
||||||
|
QCommandLineOption m_debugOption;
|
||||||
|
|
||||||
QCommandLineParser m_parser;
|
QCommandLineParser m_parser;
|
||||||
|
|
||||||
@@ -77,5 +79,6 @@ public:
|
|||||||
bool alwaysDownloadDC();
|
bool alwaysDownloadDC();
|
||||||
bool readDCVersion();
|
bool readDCVersion();
|
||||||
QString dcDir();
|
QString dcDir();
|
||||||
|
bool debug();
|
||||||
};
|
};
|
||||||
#endif // COMMAND_LINE_PARSER_H_INCLUDED
|
#endif // COMMAND_LINE_PARSER_H_INCLUDED
|
||||||
|
@@ -100,7 +100,12 @@ CommandLineParser::CommandLineParser()
|
|||||||
QCommandLineOption(
|
QCommandLineOption(
|
||||||
QStringList() << "P" << "set-ppid",
|
QStringList() << "P" << "set-ppid",
|
||||||
QCoreApplication::translate("main", "Set pid of parent process."),
|
QCoreApplication::translate("main", "Set pid of parent process."),
|
||||||
QCoreApplication::translate("main", "Set pid of parent process."))) {
|
QCoreApplication::translate("main", "Set pid of parent process.")))
|
||||||
|
, m_debugOption(
|
||||||
|
QCommandLineOption(
|
||||||
|
QStringList() << "debug" << "debug",
|
||||||
|
QCoreApplication::translate("main", "Set debug flag."),
|
||||||
|
QCoreApplication::translate("main", "Set debug flag."))) {
|
||||||
|
|
||||||
configure();
|
configure();
|
||||||
}
|
}
|
||||||
@@ -110,7 +115,7 @@ void CommandLineParser::configure() {
|
|||||||
m_parser.addHelpOption();
|
m_parser.addHelpOption();
|
||||||
m_parser.addVersionOption();
|
m_parser.addVersionOption();
|
||||||
|
|
||||||
m_repositoryUrlOption.setDefaultValue("https://git.mimbach49.de/GerhardHoffmann");
|
m_repositoryUrlOption.setDefaultValue("https://ptu-config.atb-comm.de/ATB/");
|
||||||
m_parser.addOption(m_repositoryUrlOption);
|
m_parser.addOption(m_repositoryUrlOption);
|
||||||
|
|
||||||
m_iniFileDirectoryOption.setDefaultValue(QCoreApplication::applicationDirPath());
|
m_iniFileDirectoryOption.setDefaultValue(QCoreApplication::applicationDirPath());
|
||||||
@@ -163,6 +168,9 @@ void CommandLineParser::configure() {
|
|||||||
|
|
||||||
m_setPPid.setDefaultValue("-1");
|
m_setPPid.setDefaultValue("-1");
|
||||||
m_parser.addOption(m_setPPid);
|
m_parser.addOption(m_setPPid);
|
||||||
|
|
||||||
|
m_debugOption.setDefaultValue("false");
|
||||||
|
m_parser.addOption(m_debugOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandLineParser::readSettings() {
|
void CommandLineParser::readSettings() {
|
||||||
@@ -180,7 +188,7 @@ void CommandLineParser::readSettings() {
|
|||||||
for (QString const &key: keys) {
|
for (QString const &key: keys) {
|
||||||
QVariant v = settings.value(key);
|
QVariant v = settings.value(key);
|
||||||
|
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
// qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
||||||
// << key << " -> " << v.toString();
|
// << key << " -> " << v.toString();
|
||||||
|
|
||||||
if (key.contains("repository-url")) {
|
if (key.contains("repository-url")) {
|
||||||
@@ -227,6 +235,9 @@ void CommandLineParser::readSettings() {
|
|||||||
} else
|
} else
|
||||||
if (key.contains("read-dc-version")) {
|
if (key.contains("read-dc-version")) {
|
||||||
m_readDCVersion = (v.toBool() ? "true" : "false");
|
m_readDCVersion = (v.toBool() ? "true" : "false");
|
||||||
|
} else
|
||||||
|
if (key.contains("debug")) {
|
||||||
|
m_debug = (v.toBool() ? "true" : "false");
|
||||||
} else {
|
} else {
|
||||||
qCritical() << __PRETTY_FUNCTION__
|
qCritical() << __PRETTY_FUNCTION__
|
||||||
<< key << " -> (UNKNOWN) " << v.toString();
|
<< key << " -> (UNKNOWN) " << v.toString();
|
||||||
@@ -288,6 +299,13 @@ bool CommandLineParser::readDCVersion() {
|
|||||||
return m_readDCVersion == "false" ? false : true;
|
return m_readDCVersion == "false" ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CommandLineParser::debug() {
|
||||||
|
if (m_parser.isSet(m_debugOption)) {
|
||||||
|
m_debug = m_parser.value(m_debugOption);
|
||||||
|
}
|
||||||
|
return m_debug == "false" ? false : true;
|
||||||
|
}
|
||||||
|
|
||||||
QString CommandLineParser::workingDir() {
|
QString CommandLineParser::workingDir() {
|
||||||
if (m_parser.isSet(m_workingDirectoryOption)) {
|
if (m_parser.isSet(m_workingDirectoryOption)) {
|
||||||
m_workingDir = m_parser.value(m_workingDirectoryOption);
|
m_workingDir = m_parser.value(m_workingDirectoryOption);
|
||||||
|
Reference in New Issue
Block a user