From: Maxim Mamontov Date: Wed, 28 May 2014 15:47:33 +0000 (+0300) Subject: Added service and corporation params. X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/c1b9be104712ea200385bd4f7d76f185a2d76eb7?hp=1cabba873c9409b7c01280d9839499e955d3bf58 Added service and corporation params. --- diff --git a/projects/sgconf/corps.cpp b/projects/sgconf/corps.cpp index aee446b2..97c3add0 100644 --- a/projects/sgconf/corps.cpp +++ b/projects/sgconf/corps.cpp @@ -29,6 +29,13 @@ std::cout << Indent(level, true) << "name: " << info.name << "\n" << Indent(level) << "cash: " << info.cash << "\n"; } +std::vector GetCorpParams() +{ +std::vector params; +params.push_back({"cash", "", "\tcorporation's cash"}); +return params; +} + void SimpleCallback(bool result, const std::string & reason, void * /*data*/) @@ -124,10 +131,11 @@ return false; void SGCONF::AppendCorpsOptionBlock(COMMANDS & commands, OPTION_BLOCKS & blocks) { +std::vector params(GetCorpParams()); blocks.Add("Corporation management options") .Add("get-corps", SGCONF::MakeAPIAction(commands, GetCorpsFunction), "\tget corporation list") .Add("get-corp", SGCONF::MakeAPIAction(commands, "", GetCorpFunction), "get corporation") - .Add("add-corp", SGCONF::MakeAPIAction(commands, "", AddCorpFunction), "add corporation") + .Add("add-corp", SGCONF::MakeAPIAction(commands, "", params, AddCorpFunction), "add corporation") .Add("del-corp", SGCONF::MakeAPIAction(commands, "", DelCorpFunction), "del corporation") - .Add("chg-corp", SGCONF::MakeAPIAction(commands, "", ChgCorpFunction), "change corporation"); + .Add("chg-corp", SGCONF::MakeAPIAction(commands, "", params, ChgCorpFunction), "change corporation"); } diff --git a/projects/sgconf/services.cpp b/projects/sgconf/services.cpp index 719435c7..7989de20 100644 --- a/projects/sgconf/services.cpp +++ b/projects/sgconf/services.cpp @@ -31,6 +31,15 @@ std::cout << Indent(level, true) << "name: " << info.name << "\n" << Indent(level) << "comment: " << info.comment << "\n"; } +std::vector GetServiceParams() +{ +std::vector params; +params.push_back({"cost", "", "\tcost of the service"}); +params.push_back({"pay-day", "", "payment day"}); +params.push_back({"comment", "", "comment"}); +return params; +} + void SimpleCallback(bool result, const std::string & reason, void * /*data*/) @@ -126,10 +135,11 @@ return false; void SGCONF::AppendServicesOptionBlock(COMMANDS & commands, OPTION_BLOCKS & blocks) { +std::vector params(GetServiceParams()); blocks.Add("Service management options") .Add("get-services", SGCONF::MakeAPIAction(commands, GetServicesFunction), "\tget service list") .Add("get-service", SGCONF::MakeAPIAction(commands, "", GetServiceFunction), "get service") - .Add("add-service", SGCONF::MakeAPIAction(commands, "", AddServiceFunction), "add service") + .Add("add-service", SGCONF::MakeAPIAction(commands, "", params, AddServiceFunction), "add service") .Add("del-service", SGCONF::MakeAPIAction(commands, "", DelServiceFunction), "del service") - .Add("chg-service", SGCONF::MakeAPIAction(commands, "", ChgServiceFunction), "change service"); + .Add("chg-service", SGCONF::MakeAPIAction(commands, "", params, ChgServiceFunction), "change service"); }