Break long lines of option help (#13136)

This commit is contained in:
Jude Melton-Houghton 2023-01-12 14:12:05 -05:00 committed by GitHub
parent ab1fe80150
commit 956026bb6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -389,12 +389,14 @@ static void print_help(const OptionList &allowed_options)
static void print_allowed_options(const OptionList &allowed_options)
{
for (const auto &allowed_option : allowed_options) {
std::ostringstream os1(std::ios::binary);
os1 << " --" << allowed_option.first;
std::string opt = " --" + allowed_option.first;
if (allowed_option.second.type != VALUETYPE_FLAG)
os1 << _(" <value>");
opt += _(" <value>");
std::cout << padStringRight(os1.str(), 30);
std::string opt_padded = padStringRight(opt, 30);
std::cout << opt_padded;
if (opt == opt_padded) // Line is too long to pad
std::cout << std::endl << padStringRight("", 30);
if (allowed_option.second.help)
std::cout << allowed_option.second.help;