X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/ad054ddda031f1e1f7f34942a0e5c87398d3ab6b..20d884ddac6b8cacedb2701e282efe3ff9785cbf:/projects/sgconf/main.cpp diff --git a/projects/sgconf/main.cpp b/projects/sgconf/main.cpp index 3ad0519e..babfd86f 100644 --- a/projects/sgconf/main.cpp +++ b/projects/sgconf/main.cpp @@ -24,6 +24,7 @@ #include "sg_error_codes.h" #include "xml.h" +#include "admins.h" #include "options.h" #include "actions.h" #include "config.h" @@ -377,6 +378,13 @@ ACTION * MakeAPIAction(COMMANDS & commands, return new API_ACTION(commands, paramDescription, needArgument, funPtr); } +inline +ACTION * MakeAPIAction(COMMANDS & commands, + API_FUNCTION funPtr) +{ +return new API_ACTION(commands, "", false, funPtr); +} + bool RawXMLFunction(const SGCONF::CONFIG & config, const std::string & arg, const std::map & /*options*/) @@ -1375,12 +1383,12 @@ SGCONF::OPTION_BLOCK & block = blocks.Add("Connection options") .Add("a", "address", SGCONF::MakeParamAction(config, ""), "connection params as a single string in format: :@:"); blocks.Add("Raw XML") .Add("r", "raw", SGCONF::MakeAPIAction(commands, "", true, SGCONF::RawXMLFunction), "\tmake raw XML request"); -/*blocks.Add("Admins management options") - .Add("get-admins", SGCONF::MakeConfAction()) - .Add("get-admin", SGCONF::MakeConfAction()) - .Add("add-admin", SGCONF::MakeConfAction()) - .Add("del-admin", SGCONF::MakeConfAction()) - .Add("chg-admin", SGCONF::MakeConfAction());*/ +blocks.Add("Admins management options") + .Add("get-admins", SGCONF::MakeAPIAction(commands, SGCONF::GetAdminsFunction), "\tget admin list") + .Add("get-admin", SGCONF::MakeAPIAction(commands, "", true, SGCONF::GetAdminFunction), "\tget admin") + .Add("add-admin", SGCONF::MakeAPIAction(commands, "", true, SGCONF::AddAdminFunction), "\tadd admin") + .Add("del-admin", SGCONF::MakeAPIAction(commands, "", true, SGCONF::DelAdminFunction), "\tdel admin") + .Add("chg-admin", SGCONF::MakeAPIAction(commands, "", true, SGCONF::ChgAdminFunction), "\tchange admin"); SGCONF::PARSER_STATE state(false, argc, argv);