X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/d084d9ae9f7bcd7f7d1926e7eeae921dbad49273..b339e207d5ee50c2766c04eb71904f28875e50ce:/projects/sgconf/main.cpp?ds=inline diff --git a/projects/sgconf/main.cpp b/projects/sgconf/main.cpp index a93233f2..97908195 100644 --- a/projects/sgconf/main.cpp +++ b/projects/sgconf/main.cpp @@ -25,6 +25,7 @@ #include "users.h" #include "services.h" #include "corps.h" +#include "info.h" #include "api_action.h" #include "options.h" @@ -120,7 +121,7 @@ return CONST_METHOD1_ADAPTER(func, obj); void Version(const std::string & self) { -std::cout << self << ", version: 2.0.0-alpha.\n"; +std::cout << self << ", version: 2.0.0.\n"; } void ReadUserConfigFile(SGCONF::OPTION_BLOCK & block) @@ -256,7 +257,10 @@ SGCONF::OPTION_BLOCK & block = blocks.Add("Connection options") .Add("u", "username", SGCONF::MakeParamAction(config.userName, std::string("admin"), ""), "\tadministrative login") .Add("w", "userpass", SGCONF::MakeParamAction(config.userPass, ""), "\tpassword for the administrative login") .Add("a", "address", SGCONF::MakeParamAction(config, ""), "connection params as a single string in format: :@:"); +blocks.Add("Debug options") + .Add("show-config", SGCONF::MakeParamAction(config.showConfig), "\tshow config and exit"); SGCONF::AppendXMLOptionBlock(commands, blocks); +SGCONF::AppendServerInfoBlock(commands, blocks); SGCONF::AppendAdminsOptionBlock(commands, blocks); SGCONF::AppendTariffsOptionBlock(commands, blocks); SGCONF::AppendUsersOptionBlock(commands, blocks); @@ -302,7 +306,11 @@ else config = configOverride; -std::cerr << "Config: " << config.Serialize() << std::endl; +if (!config.showConfig.empty() && config.showConfig.data()) + { + std::cout << config.Serialize() << std::endl; + return 0; + } return commands.Execute(config) ? 0 : -1; } catch (const std::exception& ex)