Boost C++ Libraries: Ticket #8430: Positional arguments help output https://svn.boost.org/trac10/ticket/8430 <p> Currently, there is no way to output positional argument descriptions. This is however often useful as special values of these options may have special results. </p> <p> I originally asked the question on <a class="ext-link" href="http://stackoverflow.com/questions/15863056/how-to-display-commandline-operand-description-in-help-output"><span class="icon">​</span>Stackoverflow</a>. </p> <p> Summarizing the question linked above, I'd like for this kind of output to be readily available: </p> <pre class="wiki">cmp: compare two files Usage: cmp [ -l | -s ] file1 file2 Options: --help Show this help output. -l (Lowercase ell.) Write the byte number (decimal) and the differing bytes (octal) for each difference. -s Write nothing for differing files; return exit status only. Operands: file1 A pathname of the first file to be compared. If file1 is '-', the standard input shall be used. file2 A pathname of the second file to be compared. If file2 is '-', the standard input shall be used. </pre><p> where file1 and file2 are pure positional arguments that have behavior warranting a full description. </p> <p> I propose a simple and backwards-compatible change to the way positional_argument_description works: </p> <pre class="wiki">po::positional_options_description operands("operands"); operands.add("file1", 1, "A pathname of the first file to be compared. If file1 is '-', the standard input shall be used.") operands.add("file2", 1, "A pathname of the second file to be compared. If file2 is '-', the standard input shall be used."); </pre><ol><li>Add an optional string argument to the constructor and store it like for normal program_descriptions </li><li>Add a third optional argument containing the description string of the positional argument </li><li>Provide an operator&lt;&lt; overload that would allow for formatted output like the above. </li></ol> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8430 Trac 1.4.3