Improve Usage output in OptionParser.

GitOrigin-RevId: 8955f6ce0643fbf871b3f3781bd36568d490eb6c
This commit is contained in:
levlam 2020-11-01 01:28:58 +03:00
parent fd2fcc3eb0
commit 36763888d4

View File

@ -219,7 +219,7 @@ StringBuilder &operator<<(StringBuilder &sb, const OptionParser &o) {
length += 4 + opt.long_key.size(); length += 4 + opt.long_key.size();
} }
if (opt.type != OptionParser::Option::Type::NoArg) { if (opt.type != OptionParser::Option::Type::NoArg) {
length += 5; length += 6;
} }
if (length > max_length) { if (length > max_length) {
max_length = length; max_length = length;
@ -247,8 +247,8 @@ StringBuilder &operator<<(StringBuilder &sb, const OptionParser &o) {
length -= 4 + opt.long_key.size(); length -= 4 + opt.long_key.size();
} }
if (opt.type != OptionParser::Option::Type::NoArg) { if (opt.type != OptionParser::Option::Type::NoArg) {
sb << "<arg>"; sb << "=<arg>";
length -= 5; length -= 6;
} }
sb << string(length, ' ') << opt.description; sb << string(length, ' ') << opt.description;
sb << '\n'; sb << '\n';