mirror of
https://github.com/etlegacy/Update-Installer.git
synced 2025-01-22 15:31:08 +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()
|
UpdaterOptions::UpdaterOptions()
|
||||||
: mode(UpdateInstaller::Setup)
|
: mode(UpdateInstaller::Setup)
|
||||||
, waitPid(0)
|
, waitPid(0)
|
||||||
|
, showVersion(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,6 +112,7 @@ void UpdaterOptions::parse(int argc, char** argv)
|
||||||
parser.setOption("script");
|
parser.setOption("script");
|
||||||
parser.setOption("wait");
|
parser.setOption("wait");
|
||||||
parser.setOption("mode");
|
parser.setOption("mode");
|
||||||
|
parser.setFlag("version");
|
||||||
|
|
||||||
parser.processCommandArgs(argc,argv);
|
parser.processCommandArgs(argc,argv);
|
||||||
|
|
||||||
|
@ -135,6 +137,8 @@ void UpdaterOptions::parse(int argc, char** argv)
|
||||||
waitPid = static_cast<PLATFORM_PID>(atoll(parser.getValue("wait")));
|
waitPid = static_cast<PLATFORM_PID>(atoll(parser.getValue("wait")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showVersion = parser.getFlag("version");
|
||||||
|
|
||||||
if (installDir.empty())
|
if (installDir.empty())
|
||||||
{
|
{
|
||||||
// if no --install-dir argument is present, try parsing
|
// if no --install-dir argument is present, try parsing
|
||||||
|
|
|
@ -16,6 +16,7 @@ class UpdaterOptions
|
||||||
std::string scriptPath;
|
std::string scriptPath;
|
||||||
PLATFORM_PID waitPid;
|
PLATFORM_PID waitPid;
|
||||||
std::string logFile;
|
std::string logFile;
|
||||||
|
bool showVersion;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void parseOldFormatArgs(int argc, char** argv);
|
void parseOldFormatArgs(int argc, char** argv);
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#define UPDATER_VERSION "0.4"
|
||||||
|
|
||||||
void runWithUi(int argc, char** argv, UpdateInstaller* installer);
|
void runWithUi(int argc, char** argv, UpdateInstaller* installer);
|
||||||
|
|
||||||
void runUpdaterThread(void* arg)
|
void runUpdaterThread(void* arg)
|
||||||
|
@ -58,6 +60,11 @@ int main(int argc, char** argv)
|
||||||
Log::instance()->open(AppInfo::logFilePath());
|
Log::instance()->open(AppInfo::logFilePath());
|
||||||
UpdaterOptions options;
|
UpdaterOptions options;
|
||||||
options.parse(argc,argv);
|
options.parse(argc,argv);
|
||||||
|
if (options.showVersion)
|
||||||
|
{
|
||||||
|
std::cout << "Update installer version " << UPDATER_VERSION << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
UpdateInstaller installer;
|
UpdateInstaller installer;
|
||||||
UpdateScript script;
|
UpdateScript script;
|
||||||
|
|
Loading…
Reference in a new issue