diff options
author | Kai Koehne <kai.koehne@theqtcompany.com> | 2014-10-23 12:39:16 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@theqtcompany.com> | 2014-10-28 15:52:22 +0100 |
commit | 3d5e24dad65a853a6b8db0f0168a50f7aede8184 (patch) | |
tree | cfe393d6389a609028c91d10c33b500c9640cfe0 | |
parent | 67ddd6b22bd26293b6c487420be7062789b4301d (diff) |
Add --framework-version argument
This prints the version number of the Qt Installer Framework. In contrast
to the more verbose '--version' argument it can be used safely by
other applications to check for the version.
Also, we might at one point decide to give the IFW user control of the
--version output: He might want to run his own version scheme to also
take into account the packaged content.
Change-Id: Ia609310659ac45c5acffe318ecb6480eeb419ee8
Reviewed-by: Jarek Kobus <jaroslaw.kobus@digia.com>
Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
-rw-r--r-- | src/sdk/commandlineparser.cpp | 3 | ||||
-rw-r--r-- | src/sdk/constants.h | 1 | ||||
-rw-r--r-- | src/sdk/main.cpp | 10 |
3 files changed, 13 insertions, 1 deletions
diff --git a/src/sdk/commandlineparser.cpp b/src/sdk/commandlineparser.cpp index 4dedb82a0..1a242bdda 100644 --- a/src/sdk/commandlineparser.cpp +++ b/src/sdk/commandlineparser.cpp @@ -47,6 +47,9 @@ CommandLineParser::CommandLineParser() m_parser.addOption(QCommandLineOption(QLatin1String(CommandLineOptions::Version), QLatin1String("Displays version information."))); + m_parser.addOption(QCommandLineOption(QLatin1String(CommandLineOptions::FrameworkVersion), + QLatin1String("Displays the version of the Qt Installer Framework."))); + m_parser.addOption(QCommandLineOption(QStringList() << QLatin1String(CommandLineOptions::VerboseShort) << QLatin1String(CommandLineOptions::VerboseLong), diff --git a/src/sdk/constants.h b/src/sdk/constants.h index 6c37fe5b9..1d4f5b5e8 100644 --- a/src/sdk/constants.h +++ b/src/sdk/constants.h @@ -40,6 +40,7 @@ namespace CommandLineOptions { const char HelpShort[] = "h"; const char HelpLong[] = "help"; const char Version[] = "version"; +const char FrameworkVersion[] = "framework-version"; const char VerboseShort[] = "v"; const char VerboseLong[] = "verbose"; const char Proxy[] = "proxy"; diff --git a/src/sdk/main.cpp b/src/sdk/main.cpp index 10b827e9e..0dc9dcdb0 100644 --- a/src/sdk/main.cpp +++ b/src/sdk/main.cpp @@ -86,7 +86,10 @@ int main(int argc, char *argv[]) const bool help = parser.isSet(QLatin1String(CommandLineOptions::HelpShort)) || parser.isSet(QLatin1String(CommandLineOptions::HelpLong)); - if (help || parser.isSet(QLatin1String(CommandLineOptions::Version)) || mutually.count()) { + if (help + || parser.isSet(QLatin1String(CommandLineOptions::Version)) + || parser.isSet(QLatin1String(CommandLineOptions::FrameworkVersion)) + || mutually.count()) { Console c; QCoreApplication app(argc, argv); @@ -99,6 +102,11 @@ int main(int argc, char *argv[]) return EXIT_SUCCESS; } + if (parser.isSet(QLatin1String(CommandLineOptions::FrameworkVersion))) { + std::cout << QUOTE(IFW_VERSION) << std::endl; + return EXIT_SUCCESS; + } + if (mutually.count() > 1) { std::cerr << qPrintable(QString::fromLatin1("The following options are mutually " "exclusive: %1.").arg(mutually.join(QLatin1String(", ")))) << std::endl; |