mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Executables: Add --version and -v to worldserver and bnetserver arguments
Closes #14993
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user