todo.txt 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. Say that variables_map is actually derived from std::map.
  2. Make parse_config_file("foo.cfg", desc) work.
  3. Document handling of positional options which depends on precedding options.
  4. I.e scanning the parsed options and creating new variables_map when we see
  5. a positional option. (Email from Tony).
  6. > My instinctive reaction is to provide both via an options argument to
  7. > split_command_line (a name that would now be more appropriate). But I
  8. > haven't devoted much time to thinking this through, so I may be wrong. :-)
  9. >
  10. > In any event, the tokenization isn't much fun. I'd expect the library to
  11. > provide a convenient mechanism for parsing a response file.
  12. > Similarly, is there some easy to use hook for customizing the "arg" to
  13. > indicate the type of the data (similar to how the textual representation
  14. > of the default argument can be changed, e.g.
  15. > value<Infile>(&forests_file)->default_value(default_in,"STDIN"), so that
  16. > I could get something like: "-f filename (=STDIN) :" instead of "-f
  17. > arg (=STDIN) :"?
  18. > A minor nit pick, with option groups (chained options_description), the
  19. > colons for the same group align but not across groups.
  20. There's another possibility:
  21. value<type>(&variable, "filename")->......
  22. something like that was in the pre-review version, with the difference that the value name was also used to specify flags, e.g "filename?" would mean the value is optional.
  23. Should we also store the name specified on the command line in basic_option,
  24. so that validation_error can mention the *specified* option name?
  25. The config file is a bit different from command line. E.g. 'bool_switch' can't
  26. be specified in the config file. Further, it's not possible to specify a list
  27. of values in config file. For example, you can't write
  28. include=a,b,c,d
  29. (or some other separator). You need:
  30. include=a
  31. ...
  32. include=d
  33. > I often find it beneficial to start a log file, by tracing all options
  34. > in effect. Thus, it would be nice if one could iterate over all values
  35. > in a variable_map and get a string representation of all values. Perhaps
  36. > as an iterator range to the original string that was parsed into the
  37. > value in the first place. Using as<string> delegates to boost::any and
  38. > only succeeds if the value is indeed a string (a design decision I can
  39. > only applaud, btw), so I'm out of luck there.
  40. UML diagram?
  41. src/cmdline.cpp: function strncmp_nocase():
  42. > maybe it can be replaced by something from string_algorithms
  43. > library. AFAIK the library should be in 1.32.
  44. > 24. the documentation may contain info what source files are needed
  45. > for which feature or whether they need to be included always all.
  46. The program_options.reference.html may contain one-liner
  47. overview for every header and every class/typedef/function
  48. listed here - just for quick browsing and overview.
  49. > > > 5. Maybe more overcommented code examples can be added into
  50. > > > docs, each exploring single feature of library.
  51. > > >
  52. > > > Some people learn mostly from such examples.
  53. > > >
  54. > > > Later note: definitely would be useful, IMO.
  55. > >
  56. > > Maybe. Do you have specific ideas what the examples can be about?
  57. >
  58. > One tiny example concentrating on one feature as short/long options,
  59. > multiple sources, hidden options, positional options, INI handling etc.
  60. > Something what user can skim over and cut/paste into app.
  61. > I would prefer that all occurrences of ASCII be capitalized. It is the
  62. > abbreviation of the name of the Standard. You may show it in lower case,
  63. > though, to distinguish "char strings in local 8-bit encoding" from the
  64. > Standard but it may confuse some readers. I can't think of a good
  65. > alternative right now.
  66. > [By the way, "positional options" _desperately_ needs an entry in the
  67. > glossary. It's the most mystifying term in the library.]
  68. > If not already stated, you should note that all options must appear in the
  69. > options description layer (or class or object). No options may make their
  70. > first appearance in the runtime configuration file, for instance. The
  71. > library doesn't like surprises. (I bring this up because other
  72. > initialization libraries allow an option to be declared in the
  73. > configuration file alone. The file reader stores the option and parses it
  74. > to determine its type, for example, Boolean, double, integer or string.)
  75. -----------
  76. > "In the simplest case, the name is explicitly specified, which allows the
  77. > program to decide if such an option is known."
  78. >
  79. > or
  80. >
  81. > "In the simplest case, the name is explicitly specified and the program
  82. > decides that the option is known."
  83. > (This paragraph is a bit hard to read. Maybe when I understand the library
  84. > better I can suggest some wording which flows more smoothly.)
  85. Maybe some explanation can help. Most of the time, input source contains both
  86. the name of option and the value, for example, --foo=10. In this case, we
  87. just lookup the option name, decide we know this option, and process it.
  88. In one specific case -- positional command line options, we don't have
  89. explicit name. For example:
  90. my_prog 1 2 3
  91. so more complex logic is necessary.
  92. > Rather than clutter up this list it might be better for the word "sources"
  93. > to be a link to another part of the document which lists the sources and
  94. > the order of precedence.
  95. Style of 'screen' in docs.
  96. > Perhaps you should include some sample output to show correct and incorrect
  97. > locale support or include a link to somewhere else in Boost where the
  98. > reader can find more information. I wouldn't know a Unicode if it came up
  99. > and bit me on the ankle.
  100. > "Common cases are when the value is explicitly specified by the user, and
  101. > when the value cannot be specified by the user, but the presense of the
  102. > option implies some value (for example, <code>true</code>). So, the parser
  103. > checks that the value is specified when needed and not specified when not
  104. > needed, and returns new (name, value) pair."
  105. >
  106. > This wording is quite stiff and I can't decipher it, especially the "not
  107. > specified when not needed" phrase. Can you rewrite this?
  108. > While I'm thinking about it, can you add the "Last revised..." line at the
  109. > bottom of each HTML page as it is on program_options.html or it that
  110. > governed by an xsl file?
  111. > If it doesn't already exist, there should be something in the tutorial to
  112. > explicitly define the steps required prior to the use of a configuration
  113. > variable as:
  114. > 1. declaration
  115. > 2. addition or composition
  116. > 3. storage or insertion
  117. > 4. notification.
  118. > I think a few lines should be added to aid the library user with the test
  119. > programs. You could place them here in howto.xml or elsewhere or in a new
  120. > section entirely. Users will want to know if their compiler is known to
  121. > work with the library and should be directed to the Boost Compiler Status
  122. > Tables page (\status\compiler_status.html or similar) or directly to the
  123. > Compiler Status Summary (http://boost.sourceforge.net/regression-logs/).
  124. > Many users will want to run the test programs on their own computer. Your
  125. > documentation should answer these questions:
  126. > Which libraries must be linked to build the programs? (Dynamic? Static?)
  127. > Are there any other special considerations or any compiler switches to be
  128. > set? For those without a full Boost package, which other Boost libraries
  129. > are "included" by the test programs and, therefore, must be available?
  130. Basically, it's assumed that test programs with be run with Boost.Build.
  131. Maybe it's worth noting that if a user wants to compiler them himself,
  132. he should link the program_options library.
  133. > If you decide to make a separate section to describe the implementation of
  134. > the test programs, you might move the "test_convert" paragraphs starting at
  135. > line 379 of howto.xml there and put a referring link in its place.
  136. > I thought there was a bit of correspondence on one of the Boost mailing
  137. > lists concerning the inability of program_options to show the stored
  138. > variables 'en masse' but I can't find it now. You should include that in
  139. > the documentation. Most users will be searching for a method to verify that
  140. > command line and configuration file values were actually stored in place of
  141. > the default values, for instance. You could put in a line or two stating
  142. > that there is no one function which will send the entire database to a file
  143. > for later review. (I think it had something to do with the fact that
  144. > program_options doesn't "know" the type of each option.) I think it will
  145. > acquire the status of a Frequently-Asked Question.)
  146. > > Agreed. Though it's no FAQ section yet.... maybe, I can add this to howto
  147. >
  148. > section, though a question without full solution is not good.
  149. >
  150. > For the time being, those who want to know if such a display function
  151. > exists will have their question answered and the reason for it. I suppose
  152. > that the library user could insert a series of statements in his program
  153. > immediately after the "notify" function which would write each known option
  154. > to a file for later examination. Some people may use a number of "assert"
  155. > statements instead. They would only come into play in the debug mode.
  156. More visibility for bool_switch.
  157. > BTW: I thought of one other comment. One of the things I missed a little
  158. > in the documentation is a description of the config file format, as well
  159. > as what can be achieved with the po::command_line_style::style_t enum. I
  160. > think most users will need this information sooner or later. A few
  161. > examples would be fine... But then again time is such a precious thing
  162. > Does the library supports sections in config files
  163. > What about the combination of (if some user-settable switch is thrown,
  164. > but not by default):
  165. >
  166. > * allowing unknown options -- these are considered positional parameters
  167. > * rearranging the argument list such that all positional parameters
  168. > are moved to the end
  169. >
  170. > This way:
  171. >
  172. > program --unknown 42 --known-flag --known-arg value
  173. >
  174. > is handled as if it were (in standard UNIX command-line-ese):
  175. >
  176. > program --known-flag --known-arg value -- --unknown 42