fix description formatting

This commit is contained in:
Jarryd Beck 2014-10-13 15:58:17 +11:00
parent 2e4c78805d
commit abf96da697
2 changed files with 7 additions and 3 deletions

View File

@ -101,14 +101,16 @@ namespace cxxopts
result.append(startLine, current + 1);
result.append("\n");
result.append(start, ' ');
startLine = current + 1;
lastSpace = startLine;
}
else
{
result.append(startLine, current);
result.append(startLine, lastSpace);
result.append("\n");
result.append(start, ' ');
startLine = lastSpace + 1;
}
startLine = lastSpace + 1;
size = 0;
}
else
@ -405,7 +407,7 @@ Options::help() const
longest = std::min(longest, static_cast<size_t>(OPTION_LONGEST));
//widest allowed description
int allowed = 78 - longest - OPTION_DESC_GAP;
int allowed = 76 - longest - OPTION_DESC_GAP;
auto fiter = format.begin();
for (const auto& o : group->second)

View File

@ -40,6 +40,8 @@ int main(int argc, char* argv[])
("positional",
"Positional arguments: these are the arguments that are entered "
"without an option", cxxopts::value<std::string>())
("long-description",
"thisisareallylongwordthattakesupthewholelineandcannotbebrokenataspace")
("help", "Print help")
;