]> git.lizzy.rs Git - minetest.git/commitdiff
Break long lines of option help (#13136)
authorJude Melton-Houghton <jwmhjwmh@gmail.com>
Thu, 12 Jan 2023 19:12:05 +0000 (14:12 -0500)
committerGitHub <noreply@github.com>
Thu, 12 Jan 2023 19:12:05 +0000 (14:12 -0500)
src/main.cpp

index e9b320af79d1db391faba7f89090d8b88c45c279..35dcb708b2634ffe7ef933e61746c141aefba13f 100644 (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;