Parse psa-config-directory and psa-tariff-directory.
This commit is contained in:
parent
1964b08349
commit
fc75585de3
@ -60,6 +60,16 @@ CommandLineParser::CommandLineParser()
|
||||
QStringList() << "working-directory" << "working-directory",
|
||||
QCoreApplication::translate("main", "working directory of update-script."),
|
||||
QCoreApplication::translate("main", "directory")))
|
||||
, m_psaConfigDirectoryOption(
|
||||
QCommandLineOption(
|
||||
QStringList() << "psa-config-directory" << "psa-config-directory",
|
||||
QCoreApplication::translate("main", "config directory of json-files sent to dc."),
|
||||
QCoreApplication::translate("main", "directory")))
|
||||
, m_psaTariffDirectoryOption(
|
||||
QCommandLineOption(
|
||||
QStringList() << "psa-tariff-directory" << "psa-tariff-directory",
|
||||
QCoreApplication::translate("main", "tariff directory of tariff-json-files."),
|
||||
QCoreApplication::translate("main", "directory")))
|
||||
, m_dryRunOption(
|
||||
QCommandLineOption(
|
||||
QStringList() << "d" << "dry-run",
|
||||
@ -111,6 +121,12 @@ void CommandLineParser::configure() {
|
||||
m_workingDirectoryOption.setDefaultValue("/opt/app/tools/atbupdate/");
|
||||
m_parser.addOption(m_workingDirectoryOption);
|
||||
|
||||
m_psaConfigDirectoryOption.setDefaultValue("etc/psa_config/");
|
||||
m_parser.addOption(m_psaConfigDirectoryOption);
|
||||
|
||||
m_psaTariffDirectoryOption.setDefaultValue("etc/psa_tariff/");
|
||||
m_parser.addOption(m_psaTariffDirectoryOption);
|
||||
|
||||
m_dryRunOption.setDefaultValue("false");
|
||||
m_parser.addOption(m_dryRunOption);
|
||||
|
||||
@ -151,6 +167,12 @@ void CommandLineParser::readSettings() {
|
||||
if (key.contains("working-directory")) {
|
||||
m_workingDir = v.toString();
|
||||
} else
|
||||
if (key.contains("psa-config-directory")) {
|
||||
m_psaConfigDir = v.toString();
|
||||
} else
|
||||
if (key.contains("psa-tariff-directory")) {
|
||||
m_psaTariffDir = v.toString();
|
||||
} else
|
||||
if (key.contains("dry-run")) {
|
||||
m_dryRun = (v.toBool() ? "true" : "false");
|
||||
} else
|
||||
@ -207,6 +229,20 @@ QString CommandLineParser::plugInName() {
|
||||
return m_plugInName;
|
||||
}
|
||||
|
||||
QString CommandLineParser::psaConfigDir() {
|
||||
if (m_parser.isSet(m_psaConfigDirectoryOption)) {
|
||||
m_psaConfigDir = m_parser.value(m_psaConfigDirectoryOption);
|
||||
}
|
||||
return m_psaConfigDir;
|
||||
}
|
||||
|
||||
QString CommandLineParser::psaTariffDir() {
|
||||
if (m_parser.isSet(m_psaTariffDirectoryOption)) {
|
||||
m_psaTariffDir = m_parser.value(m_psaTariffDirectoryOption);
|
||||
}
|
||||
return m_psaTariffDir;
|
||||
}
|
||||
|
||||
QString CommandLineParser::workingDir() {
|
||||
if (m_parser.isSet(m_workingDirectoryOption)) {
|
||||
m_workingDir = m_parser.value(m_workingDirectoryOption);
|
||||
|
@ -11,6 +11,8 @@ class CommandLineParser : public QCommandLineParser {
|
||||
QString m_plugInDir;
|
||||
QString m_plugInName;
|
||||
QString m_workingDir;
|
||||
QString m_psaConfigDir;
|
||||
QString m_psaTariffDir;
|
||||
QString m_dryRun;
|
||||
QString m_noUpdatePsaHardware;
|
||||
QString m_showYoctoVersion;
|
||||
@ -29,6 +31,8 @@ class CommandLineParser : public QCommandLineParser {
|
||||
QCommandLineOption m_alwaysDownloadConfigOption;
|
||||
QCommandLineOption m_alwaysDownloadDCOption;
|
||||
QCommandLineOption m_workingDirectoryOption;
|
||||
QCommandLineOption m_psaConfigDirectoryOption;
|
||||
QCommandLineOption m_psaTariffDirectoryOption;
|
||||
QCommandLineOption m_dryRunOption;
|
||||
QCommandLineOption m_extendedVersionOption;
|
||||
QCommandLineOption m_yoctoVersionOption;
|
||||
@ -52,6 +56,8 @@ public:
|
||||
QString plugInDir();
|
||||
QString plugInName();
|
||||
QString workingDir();
|
||||
QString psaConfigDir();
|
||||
QString psaTariffDir();
|
||||
bool dryRun();
|
||||
bool noUpdatePsaHardware();
|
||||
bool yoctoVersion();
|
||||
|
Loading…
Reference in New Issue
Block a user