Improve help of short-only options (remove dangling comma)

This commit is contained in:
Akos Kiss 2020-06-02 16:34:40 +02:00
parent 794c975287
commit 4645c23cc4
2 changed files with 6 additions and 1 deletions

View File

@ -1468,7 +1468,11 @@ namespace cxxopts
if (!s.empty())
{
result += "-" + toLocalString(s) + ",";
result += "-" + toLocalString(s);
if (!l.empty())
{
result += ",";
}
}
else
{

View File

@ -49,6 +49,7 @@ parse(int argc, char* argv[])
("i,input", "Input", cxxopts::value<std::string>())
("o,output", "Output file", cxxopts::value<std::string>()
->default_value("a.out")->implicit_value("b.def"), "BIN")
("x", "A short-only option", cxxopts::value<std::string>())
("positional",
"Positional arguments: these are the arguments that are entered "
"without an option", cxxopts::value<std::vector<std::string>>())