mirror of
https://github.com/etlegacy/Update-Installer.git
synced 2024-11-10 14:41:50 +00:00
Add --version flag to print out the current version of the application.
This commit is contained in:
parent
47d79bcc6c
commit
635fecbd67
3 changed files with 13 additions and 1 deletions
|
@ -19,6 +19,7 @@ long long atoll(const char* string)
|
|||
UpdaterOptions::UpdaterOptions()
|
||||
: mode(UpdateInstaller::Setup)
|
||||
, waitPid(0)
|
||||
, showVersion(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -111,6 +112,7 @@ void UpdaterOptions::parse(int argc, char** argv)
|
|||
parser.setOption("script");
|
||||
parser.setOption("wait");
|
||||
parser.setOption("mode");
|
||||
parser.setFlag("version");
|
||||
|
||||
parser.processCommandArgs(argc,argv);
|
||||
|
||||
|
@ -135,6 +137,8 @@ void UpdaterOptions::parse(int argc, char** argv)
|
|||
waitPid = static_cast<PLATFORM_PID>(atoll(parser.getValue("wait")));
|
||||
}
|
||||
|
||||
showVersion = parser.getFlag("version");
|
||||
|
||||
if (installDir.empty())
|
||||
{
|
||||
// if no --install-dir argument is present, try parsing
|
||||
|
|
|
@ -16,6 +16,7 @@ class UpdaterOptions
|
|||
std::string scriptPath;
|
||||
PLATFORM_PID waitPid;
|
||||
std::string logFile;
|
||||
bool showVersion;
|
||||
|
||||
private:
|
||||
void parseOldFormatArgs(int argc, char** argv);
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
#define UPDATER_VERSION "0.4"
|
||||
|
||||
void runWithUi(int argc, char** argv, UpdateInstaller* installer);
|
||||
|
||||
void runUpdaterThread(void* arg)
|
||||
|
@ -58,6 +60,11 @@ int main(int argc, char** argv)
|
|||
Log::instance()->open(AppInfo::logFilePath());
|
||||
UpdaterOptions options;
|
||||
options.parse(argc,argv);
|
||||
if (options.showVersion)
|
||||
{
|
||||
std::cout << "Update installer version " << UPDATER_VERSION << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
UpdateInstaller installer;
|
||||
UpdateScript script;
|
||||
|
|
Loading…
Reference in a new issue