You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cxxopts::Options opts("ai-server", "ai server");
opts.add_options("general")
("h,help", "Print usage", cxxopts::value<std::vector<std::string>>()->implicit_value(""))
("groups", "Print all groups")
("print", "Print configure values of special group. Empty group means all group.", cxxopts::value<std::string>()->implicit_value(""));
opts.add_options("cfgo")
("s,signal_url", "The url of signal server of conference.go", cxxopts::value<std::string>()->default_value(get_default_opt_from_env("SR_CFGO_SIGNAL_URL", "")))
("appsink_drop", "Drop old buffers when the buffer queue is filled", cxxopts::value<bool>()->default_value(get_default_opt_from_env("SR_CFGO_APPSINK_DROP", "false")))
("appsink_max_buffers", "Maximum amount of buffers in the queue (0 = unlimited).", cxxopts::value<std::uint32_t>()->default_value(get_default_opt_from_env("SR_CFGO_APPSINK_MAX_BUFFERS", "0")))
("appsink_max_bytes", "Maximum amount of bytes in the queue (0 = unlimited)", cxxopts::value<std::uint64_t>()->default_value(get_default_opt_from_env("SR_CFGO_APPSINK_MAX_BYTES", "0")))
("appsink_max_time", "Maximum total duration of data in the queue (0 = unlimited)", cxxopts::value<std::uint64_t>()->default_value(get_default_opt_from_env("SR_CFGO_APPSINK_MAX_TIME", "0")));>implicit_value(""));
auto result = opts.parse(argc, argv);
if (result.count("help"))
{
auto & groups = result["help"].as<std::vector<std::string>>();
for (auto && g : groups)
{
std::cout << "group: " << g << std::endl;
}
if (groups.size() == 1 && groups[0].empty())
{
std::cout << opts.help(opts.groups()) << std::endl;
}
else
{
std::cout << opts.help(groups) << std::endl;
}
exit(0);
}
main --help=general,cfgo print:
group: general
group: cfgo
ai server
Usage:
ai-server [OPTION...]
general options:
-h, --help [=arg(=)] Print usage
--groups Print all groups
--print [=arg(=)] Print configure values of special group. Empty
group means all group.
cfgo options:
-s, --signal_url arg The url of signal server of conference.go
(default: "")
--appsink_drop Drop old buffers when the buffer queue is
filled
--appsink_max_buffers arg
Maximum amount of buffers in the queue (0 =
unlimited). (default: 0)
--appsink_max_bytes arg Maximum amount of bytes in the queue (0 =
unlimited) (default: 0)
--appsink_max_time arg Maximum total duration of data in the queue
(0 = unlimited) (default: 0)
main -hgeneral,cfgo print:
terminate called after throwing an instance of 'cxxopts::exceptions::no_such_option'
what(): Option 'g' does not exist
Aborted (core dumped)
main -h general,cfgo print
group:
ai server
Usage:
ai-server [OPTION...]
...
cxxopts think no argument is put to h opt. so goup is implicit_value {""}
By the way, how to make implicit_value of std::vectorstd::string as empty vector? "" means a vector with one empty string element, it's too strange.
The text was updated successfully, but these errors were encountered:
main --help=general,cfgo
print:main -hgeneral,cfgo
print:main -h general,cfgo
printcxxopts think no argument is put to h opt. so goup is implicit_value {""}
By the way, how to make implicit_value of std::vectorstd::string as empty vector? "" means a vector with one empty string element, it's too strange.
The text was updated successfully, but these errors were encountered: