Core/Executables: Add --version and -v to worldserver and bnetserver arguments

Closes #14993
This commit is contained in:
DDuarte
2015-07-04 00:45:52 +01:00
parent 7e906d7b19
commit 0f082e8f92
2 changed files with 14 additions and 4 deletions

View File

@@ -84,8 +84,8 @@ int main(int argc, char** argv)
std::string configFile = _TRINITY_BNET_CONFIG;
std::string configService;
auto vm = GetConsoleArguments(argc, argv, configFile, configService);
// exit if help is enabled
if (vm.count("help"))
// exit if help or version is enabled
if (vm.count("help") || vm.count("version"))
return 0;
#if PLATFORM == PLATFORM_WINDOWS
@@ -275,6 +275,7 @@ variables_map GetConsoleArguments(int argc, char** argv, std::string& configFile
options_description all("Allowed options");
all.add_options()
("help,h", "print usage message")
("version,v", "print version build info")
("config,c", value<std::string>(&configFile)->default_value(_TRINITY_BNET_CONFIG), "use <arg> as configuration file")
;
#if PLATFORM == PLATFORM_WINDOWS
@@ -300,6 +301,10 @@ variables_map GetConsoleArguments(int argc, char** argv, std::string& configFile
{
std::cout << all << "\n";
}
else if (variablesMap.count("version"))
{
std::cout << _FULLVERSION << "\n";
}
return variablesMap;
}

View File

@@ -105,8 +105,8 @@ extern int main(int argc, char** argv)
std::string configService;
auto vm = GetConsoleArguments(argc, argv, configFile, configService);
// exit if help is enabled
if (vm.count("help"))
// exit if help or version is enabled
if (vm.count("help") || vm.count("version"))
return 0;
#ifdef _WIN32
@@ -597,6 +597,7 @@ variables_map GetConsoleArguments(int argc, char** argv, std::string& configFile
options_description all("Allowed options");
all.add_options()
("help,h", "print usage message")
("version,v", "print version build info")
("config,c", value<std::string>(&configFile)->default_value(_TRINITY_CORE_CONFIG), "use <arg> as configuration file")
;
#ifdef _WIN32
@@ -622,6 +623,10 @@ variables_map GetConsoleArguments(int argc, char** argv, std::string& configFile
{
std::cout << all << "\n";
}
else if (vm.count("version"))
{
std::cout << _FULLVERSION << "\n";
}
return vm;
}