fix description formatting
This commit is contained in:
parent
2e4c78805d
commit
abf96da697
@ -101,14 +101,16 @@ namespace cxxopts
|
|||||||
result.append(startLine, current + 1);
|
result.append(startLine, current + 1);
|
||||||
result.append("\n");
|
result.append("\n");
|
||||||
result.append(start, ' ');
|
result.append(start, ' ');
|
||||||
|
startLine = current + 1;
|
||||||
|
lastSpace = startLine;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result.append(startLine, current);
|
result.append(startLine, lastSpace);
|
||||||
result.append("\n");
|
result.append("\n");
|
||||||
result.append(start, ' ');
|
result.append(start, ' ');
|
||||||
|
startLine = lastSpace + 1;
|
||||||
}
|
}
|
||||||
startLine = lastSpace + 1;
|
|
||||||
size = 0;
|
size = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -405,7 +407,7 @@ Options::help() const
|
|||||||
longest = std::min(longest, static_cast<size_t>(OPTION_LONGEST));
|
longest = std::min(longest, static_cast<size_t>(OPTION_LONGEST));
|
||||||
|
|
||||||
//widest allowed description
|
//widest allowed description
|
||||||
int allowed = 78 - longest - OPTION_DESC_GAP;
|
int allowed = 76 - longest - OPTION_DESC_GAP;
|
||||||
|
|
||||||
auto fiter = format.begin();
|
auto fiter = format.begin();
|
||||||
for (const auto& o : group->second)
|
for (const auto& o : group->second)
|
||||||
|
|||||||
@ -40,6 +40,8 @@ int main(int argc, char* argv[])
|
|||||||
("positional",
|
("positional",
|
||||||
"Positional arguments: these are the arguments that are entered "
|
"Positional arguments: these are the arguments that are entered "
|
||||||
"without an option", cxxopts::value<std::string>())
|
"without an option", cxxopts::value<std::string>())
|
||||||
|
("long-description",
|
||||||
|
"thisisareallylongwordthattakesupthewholelineandcannotbebrokenataspace")
|
||||||
("help", "Print help")
|
("help", "Print help")
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user