mirror of https://github.com/jarro2783/cxxopts.git
Merge df305deeaa into 0f1c5a0a79
This commit is contained in:
commit
4f5c9696a5
|
|
@ -2150,9 +2150,21 @@ format_option
|
|||
result += " ";
|
||||
}
|
||||
|
||||
if (!l.empty())
|
||||
auto is_first_name = true;
|
||||
for (const auto& name : o.l)
|
||||
{
|
||||
result += " --" + toLocalString(l);
|
||||
if (!name.empty())
|
||||
{
|
||||
if (is_first_name)
|
||||
{
|
||||
result += " --" + toLocalString(name);
|
||||
is_first_name = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
result += ", --" + toLocalString(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto arg = !o.arg_help.empty() ? toLocalString(o.arg_help) : "arg";
|
||||
|
|
|
|||
|
|
@ -1191,3 +1191,15 @@ TEST_CASE("No Options help", "[options]")
|
|||
CHECK_NOTHROW(options.parse(argc, argv));
|
||||
CHECK(options.help().find("test <posArg1>...<posArgN>") != std::string::npos);
|
||||
}
|
||||
|
||||
TEST_CASE("Help shows all aliases", "[help]")
|
||||
{
|
||||
cxxopts::Options options("Print all aliases", " - ensure help lists every long name");
|
||||
|
||||
options.add_options()
|
||||
("v,verify,ver", "Verification option", cxxopts::value<std::string>());
|
||||
|
||||
const auto help = options.help();
|
||||
|
||||
CHECK(help.find("-v, --ver, --verify arg") != std::string::npos);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue