requirements-Rozental 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. From rogeeff@mail.com Fri Nov 16 19:57:49 2001
  2. Received: from imap.cs.msu.su (imap.cs.msu.su [158.250.10.15])
  3. by redsun.cs.msu.su (8.9.3/8.9.3) with ESMTP id TAA06515
  4. for <ghost@redsun.cs.msu.su>; Fri, 16 Nov 2001 19:59:43 +0300 (MSK)
  5. Received: from n15.groups.yahoo.com (n15.groups.yahoo.com [216.115.96.65])
  6. by imap.cs.msu.su (8.11.6/8.11.6) with SMTP id fAGGtrd57869
  7. for <ghost@cs.msu.su>; Fri, 16 Nov 2001 19:55:54 +0300 (MSK)
  8. (envelope-from sentto-1234907-17382-1005929874-ghost=cs.msu.su@returns.groups.yahoo.com)
  9. X-eGroups-Return: sentto-1234907-17382-1005929874-ghost=cs.msu.su@returns.groups.yahoo.com
  10. Received: from [10.1.1.222] by n15.groups.yahoo.com with NNFMP; 16 Nov 2001 16:57:42 -0000
  11. X-Sender: rogeeff@mail.com
  12. X-Apparently-To: boost@yahoogroups.com
  13. Received: (EGP: mail-8_0_0_1); 16 Nov 2001 16:57:53 -0000
  14. Received: (qmail 2553 invoked from network); 16 Nov 2001 16:57:53 -0000
  15. Received: from unknown (216.115.97.172)
  16. by m4.grp.snv.yahoo.com with QMQP; 16 Nov 2001 16:57:53 -0000
  17. Received: from unknown (HELO n6.groups.yahoo.com) (216.115.96.56)
  18. by mta2.grp.snv.yahoo.com with SMTP; 16 Nov 2001 16:57:53 -0000
  19. X-eGroups-Return: rogeeff@mail.com
  20. Received: from [10.1.10.109] by n6.groups.yahoo.com with NNFMP; 16 Nov 2001 16:57:52 -0000
  21. To: boost@yahoogroups.com
  22. Message-ID: <9t3gid+hdf3@eGroups.com>
  23. In-Reply-To: <E164iu4-00052e-00@zigzag.cs.msu.su>
  24. User-Agent: eGroups-EW/0.82
  25. X-Mailer: eGroups Message Poster
  26. X-Originating-IP: 199.119.33.162
  27. From: "Gennadiy E. Rozental" <rogeeff@mail.com>
  28. X-Yahoo-Profile: rogeeff
  29. MIME-Version: 1.0
  30. Mailing-List: list boost@yahoogroups.com; contact boost-owner@yahoogroups.com
  31. Delivered-To: mailing list boost@yahoogroups.com
  32. Precedence: bulk
  33. List-Unsubscribe: <mailto:boost-unsubscribe@yahoogroups.com>
  34. Date: Fri, 16 Nov 2001 16:57:49 -0000
  35. Reply-To: boost@yahoogroups.com
  36. Subject: [boost] Re: arguments parsing, wildcard matcher
  37. Content-Transfer-Encoding: 7bit
  38. Content-Type: text/plain;
  39. charset=US-ASCII
  40. Content-Length: 5662
  41. Status: R
  42. X-Status: N
  43. --- In boost@y..., Vladimir Prus <ghost@c...> wrote:
  44. >
  45. > > Just a couple of classes I wrote that I wondered if anyone thought
  46. > > any place in boost:
  47. > >
  48. > > arguments : simple command-line arguments and options parser:
  49. > >
  50. > > class arguments
  51. > > {
  52. > > public:
  53. > > arguments(int argc, char* argv[]);
  54. > >
  55. > > bool has_option(const char* name) const;
  56. > > bool get_option(const char* name, bool& value) const;
  57. >
  58. > > Any interest? Already proposed? Wasting my time?
  59. >
  60. > Actually, I'm already working on library with the same goals but
  61. more
  62. > elaborated. Moreover, it's almost finished. I planned to announce
  63. it later,
  64. > but have to do it now. My design goals were:
  65. > - It should be resonable to use the library to parse as little as
  66. 2 command
  67. > line options.
  68. > - It must be extandable to privide any resonable handling
  69. > - since command line is just a way to affect the program behaviour,
  70. other
  71. > ways to accomplish that must be provided, most notable is
  72. configuration file
  73. > - library should provide a way to store information from command
  74. line and
  75. > config file in a way allowing easy retrieval and using to change
  76. configurable
  77. > parameters of the program.
  78. >
  79. > The docs are available at:
  80. > http://chronos.cs.msu.su/~ghost/projects/config_db/doc/index.html
  81. >
  82. > Let me know what you think.
  83. Privet, Volodya.
  84. Here what I am looking for to be supported by Command Line Argument
  85. Framework directly or by means of easy extension:
  86. 1. command line argument formats
  87. a. -<one letter key> <value>
  88. b. -<one letter key><value>
  89. c. -<key> <value>
  90. d. -<option> - any length
  91. e. /<key> <value> - and all other cases like a,b,c but with /
  92. instead
  93. g. --<key> <value>
  94. h. -<key substring> <value>
  95. An example: let say you expecting argument -osagent_port
  96. then following argument lists should be valid:
  97. -o 15000
  98. -osa 15000
  99. -osagent_port 15000
  100. On the other hand it should perform validity checks. For example
  101. if you also expect another argument -osagent_host. then first 2
  102. argument list above should generate runtime error and 3d should
  103. pass. Arguments integrity check should also be performed, i.e.
  104. you should not allow for user to define 2 argument like this:
  105. "-port"
  106. "-port_type"
  107. 2. argument types
  108. I should be able to explicitle specify expected argument type. For
  109. example: std::string, int, double, option(bool). The framework should
  110. perform value validation. For example 1.23 is not valid for int
  111. argument. The framework should allow to use user-defined classes as
  112. expected types for command-line argument. In other word. If I provide
  113. you a class with predefined psecification framework should try to
  114. generate object of argument class. Some simple extention you can
  115. provide youself. For example, using following command line you should
  116. be able to generate std::list<int>
  117. -values 2 5 7 8
  118. and using following command line you should be able to generate
  119. std::list<std::string>
  120. -files_to_test test1.td test2.td test3.td test4.td
  121. and using following command line user should be able to provide
  122. argument class A to generate std::list<A>
  123. struct A{
  124. std::string key;
  125. int value;
  126. };
  127. -parameters_mapping name1 4 name5 7 name6 8 name9 1123
  128. 3. argument storage.
  129. a. Framework should be able to generate and store arguments
  130. internally. In this case framework in responsable for memory.
  131. b. Framework should be able to generate and store argument into the
  132. user-bound location. In this case user in responsable for memory.
  133. 4. arguments can have default values
  134. 5. arguments can be optional and required. The framework should
  135. automatically check presence of of all required arguments.
  136. 6. argument value access
  137. a. if user passed storage location - he will be able to get value
  138. from there
  139. b. by name and type. If any of them is incorrect - error. The same
  140. rules aplied here as in 1.h if argument matching algorithm allows
  141. substrings.
  142. c. is_present check - to be able to check presence of optional
  143. arguments.
  144. 7. usage line.
  145. The framework should be able to generate a using line given a
  146. difinition of all feilds. To support this you will probably need
  147. argument description as one of the command line argument
  148. constructor's argument. Thr framework should be able to configured to
  149. use different usage line. If command line contain predefined keyword
  150. (-help or /? for example) framework should print usage message.
  151. 8. Framework Error
  152. If any of the following condition occures during command line
  153. processing the framework should generate an error and print a usage
  154. line:
  155. a. invalid aargument
  156. b. ambiguous argument
  157. c. invalid value for the argument
  158. d. absence of required argument
  159. e. framework meet -help (of any other predefined keyword)
  160. Invalid name or type should generate exception during value access.
  161. Here my view on the problem.
  162. Regards,
  163. Gennadiy.
  164. P.S. Did you look into Brat Appleton's work? It seems to be close to
  165. what you are doing.
  166. >
  167. > Concerning your proposal, I can mark two points, apart from it's
  168. been a
  169. > subset of mine:
  170. > 1. It uses get_options(const char* name, type& value) methods,
  171. which are not
  172. > extendable (and the similar thing is used in KConfig class in
  173. KDE....) What I
  174. > propose is
  175. > variables_map vm .....
  176. > int i = vm["magic"].as<int>()
  177. > FontName fn = vm["font"].as<FontName>()
  178. > 2. You propose wildcard expansions. This is good. But it is easy to
  179. add it to
  180. > any existing command line parsing library.
  181. >
  182. > - Volodya
  183. Info: http://www.boost.org Unsubscribe: <mailto:boost-unsubscribe@yahoogroups.com>
  184. Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/