comparison irccdctl/cli.cpp @ 498:fbd80bfcf58d

Irccd: import new options, closes #713
author David Demelier <markand@malikania.fr>
date Sat, 30 Sep 2017 10:31:08 +0200
parents 349fe29d86d5
children e03521cf207b
comparison
equal deleted inserted replaced
497:d7882b30b01a 498:fbd80bfcf58d
350 * ------------------------------------------------------------------ 350 * ------------------------------------------------------------------
351 */ 351 */
352 352
353 namespace { 353 namespace {
354 354
355 option::Result parse(std::vector<std::string> &args) 355 option::result parse(std::vector<std::string> &args)
356 { 356 {
357 option::Options options{ 357 option::options options{
358 { "-c", true }, 358 { "-c", true },
359 { "--command", true }, 359 { "--command", true },
360 { "-n", true }, 360 { "-n", true },
361 { "--nickname", true }, 361 { "--nickname", true },
362 { "-r", true }, 362 { "-r", true },
394 394
395 void ServerConnectCli::exec(Irccdctl &irccdctl, const std::vector<std::string> &args) 395 void ServerConnectCli::exec(Irccdctl &irccdctl, const std::vector<std::string> &args)
396 { 396 {
397 std::vector<std::string> copy(args); 397 std::vector<std::string> copy(args);
398 398
399 option::Result result = parse(copy); 399 option::result result = parse(copy);
400 option::Result::const_iterator it; 400 option::result::const_iterator it;
401 401
402 if (copy.size() < 2) 402 if (copy.size() < 2)
403 throw std::invalid_argument("server-connect requires at least 2 arguments"); 403 throw std::invalid_argument("server-connect requires at least 2 arguments");
404 404
405 auto object = nlohmann::json::object({ 405 auto object = nlohmann::json::object({
867 { 867 {
868 } 868 }
869 869
870 void RuleAddCli::exec(Irccdctl &irccdctl, const std::vector<std::string> &args) 870 void RuleAddCli::exec(Irccdctl &irccdctl, const std::vector<std::string> &args)
871 { 871 {
872 static const option::Options options{ 872 static const option::options options{
873 { "-c", true }, 873 { "-c", true },
874 { "--add-channel", true }, 874 { "--add-channel", true },
875 { "-e", true }, 875 { "-e", true },
876 { "--add-event", true }, 876 { "--add-event", true },
877 { "-i", true }, 877 { "-i", true },
950 { 950 {
951 } 951 }
952 952
953 void RuleEditCli::exec(Irccdctl &irccdctl, const std::vector<std::string> &args) 953 void RuleEditCli::exec(Irccdctl &irccdctl, const std::vector<std::string> &args)
954 { 954 {
955 static const option::Options options{ 955 static const option::options options{
956 { "-a", true }, 956 { "-a", true },
957 { "--action", true }, 957 { "--action", true },
958 { "-c", true }, 958 { "-c", true },
959 { "--add-channel", true }, 959 { "--add-channel", true },
960 { "-C", true }, 960 { "-C", true },