[Boost-bugs] [Boost C++ Libraries] #6114: Program options help message do not align across multiple groups

Subject: [Boost-bugs] [Boost C++ Libraries] #6114: Program options help message do not align across multiple groups
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-11-11 12:24:21


#6114: Program options help message do not align across multiple groups
-----------------------------------------------+----------------------------
 Reporter: Leo Goodstadt <boost@…> | Owner: vladimir_prus
     Type: Patches | Status: new
Milestone: To Be Determined | Component: program_options
  Version: Boost 1.47.0 | Severity: Problem
 Keywords: Program options help description |
-----------------------------------------------+----------------------------
 libs/program_options/src/options_description.cpp contains code to line up
 the description strings if the length of the options column > 23.

 However, this does not take different groups into account.
 The patch gets the column lengths from the subgroups as well.

 Current situation:
 {{{
 Overall:

 Option group 1:
   --opt1 Short option 1
   --option 2 Short option 2
                         ^
                         Aligned here

 Option group 2:
   --much_longer_option arg Misaligned description in 2nd group if option
 column
                            length > magic 23 character limit
                            ^
                            Aligned here
 }}}

 Patched:
 {{{
 Overall:

 Option group 1:
   --opt1 Short option 1
   --option 2 Short option 2
                             ^
                             Aligned here

 Option group 2:
   --much_longer_option arg Misaligned description in 2nd group if option
                             column length > magic 23 character limit
                             ^
                             Aligned here

 }}}

 is produced by this minimal program
 {{{#!cpp
 #include <iostream>
 #include <boost/program_options.hpp>
 namespace po = boost::program_options;

 int main (int argc, char *argv[])
 {
     // 1st group
     po::options_description groups1 ("Option group 1");
     groups1.add_options()
         ("opt1", "Short option 1")
         ("option 2", "Short option 2\n^\nAligned here");

     // 2nd group
     po::options_description groups2 ("Option group 2");
     groups2.add_options()
       ("much_longer_option", po::value<int>(),
            "Misaligned description in 2nd group if option "
            "column length > magic 23 character limit\n^\n"
            "Aligned here");


     po::options_description cmdline_args("Overall");
     cmdline_args.add(groups1);
     cmdline_args.add(groups2);
     std::cerr << cmdline_args << "\n";

     return 0;
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6114>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC