<li><a href="#valrequired">Controlling whether or not a value must be
specified</a>
<li><a href="#formatting">Controlling other formatting options</a>
+ <li><a href="#misc">Miscellaneous option modifiers</a>
</ul>
<li><a href="#toplevel">Top-Level Classes and Functions</a>
<ul>
<li>Speed: The CommandLine library is very quick and uses little resources. The
parsing time of the library is directly proportional to the number of arguments
parsed, not the the number of options recognized. Additionally, command line
-argument values are captured transparently into user defined variables, which
-can be accessed like any other variable (and with the same performance).<p>
+argument values are captured transparently into user defined global variables,
+which can be accessed like any other variable (and with the same
+performance).<p>
<li>Type Safe: As a user of CommandLine, you don't have to worry about
remembering the type of arguments that you want (is it an int? a string? a
Now that you are ready to support command line arguments, we need to tell the
system which ones we want, and what type of argument they are. The CommandLine
-library uses a declarative syntax to model cammand line arguments with the
-variable declarations that capture the parsed values. This means that for every
-command line option that you would like to support, there should be a variable
-declaration to capture the result. For example, in a compiler, we would like to
-support the unix standard '<tt>-o <filename></tt>' option to specify where
-to put the output. With the CommandLine library, this is represented like
-this:<p>
+library uses a declarative syntax to model command line arguments with the
+global variable declarations that capture the parsed values. This means that
+for every command line option that you would like to support, there should be a
+global variable declaration to capture the result. For example, in a compiler,
+we would like to support the unix standard '<tt>-o <filename></tt>' option
+to specify where to put the output. With the CommandLine library, this is
+represented like this:<p>
<pre><a name="value_desc_example">
<a href="#cl::opt">cl::opt</a><string> OutputFilename("<i>o</i>", <a href="#cl::desc">cl::desc</a>("<i>Specify output filename</i>"), <a href="#cl::value_desc">cl::value_desc</a>("<i>filename</i>"));
</pre><p>
-This declares a variable "<tt>OutputFilename</tt>" that is used to capture the
-result of the "<tt>o</tt>" argument (first parameter). We specify that this is
-a simple scalar option by using the "<tt><a href="#cl::opt">cl::opt</a></tt>"
-template (as opposed to the <a href="#list">"<tt>cl::list</tt>
-template</a>), and tell the CommandLine library that the data type that we are
-parsing is a string.<p>
+This declares a global variable "<tt>OutputFilename</tt>" that is used to
+capture the result of the "<tt>o</tt>" argument (first parameter). We specify
+that this is a simple scalar option by using the "<tt><a
+href="#cl::opt">cl::opt</a></tt>" template (as opposed to the <a
+href="#list">"<tt>cl::list</tt> template</a>), and tell the CommandLine library
+that the data type that we are parsing is a string.<p>
The second and third parameters (which are optional) are used to specify what to
output for the "<tt>--help</tt>" option. In this case, we get a line that looks
};
// Enable Debug Options to be specified on the command line
-<a href="#cl::opt">cl::opt</a><DebugLev> DebugLevel("<i>debug_level</i>", <a href="#cl::desc">cl::desc</a>("<i>Set the debugging level:</i>"),
+<a href="#cl::opt">cl::opt</a><DebugLev> DebugLevel("<i>debug_level</i>", <a href="#cl::desc">cl::desc</a>("<i>Set the debugging level:</i>"),
<a href="#cl::values">cl::values</a>(
clEnumValN(nodebuginfo, "none", "<i>disable debug information</i>"),
clEnumVal(quick, "<i>enable quick debug information</i>"),
tweak how options are parsed and how <tt>--help</tt> output is generated to fit
your application well.<p>
-These options naturally fall into four main catagories:<p>
+These options fall into five main catagories:<p>
<ol>
<li><a href="#hiding">Hiding an option from <tt>--help</tt> output</a>
<li><a href="#valrequired">Controlling whether or not a value must be
specified</a>
<li><a href="#formatting">Controlling other formatting options</a>
+<li><a href="#misc">Miscellaneous option modifiers</a>
</ol><p>
It is not possible to specify two options from the same catagory (you'll get a
-runtime error) to a single option. The CommandLine library specifies defaults
-for all of these settings that are the most useful in practice and the most
-common, which mean that you usually shouldn't have to worry about these.<p>
+runtime error) to a single option, except for options in the miscellaneous
+catagory. The CommandLine library specifies defaults for all of these settings
+that are the most useful in practice and the most common, which mean that you
+usually shouldn't have to worry about these.<p>
<!-- _______________________________________________________________________ -->
<tt>}</tt><p>
+
+<!-- _______________________________________________________________________ -->
+</ul><a name="misc"><h4><hr size=0>Miscellaneous option modifiers</h4><ul>
+
+The miscellaneous option modifiers are the only flags where you can specify more
+than one flag from the set: they are not mutually exclusive. These flags
+specify boolean properties that modify the option.<p>
+
+<ul>
+
+<a name="cl::CommaSeparated">The <b><tt>cl::CommaSeparated</tt></b> modifier
+indicates that any commas specified for an option's value should be used to
+split the value up into multiple values for the option. For example, these two
+options are equivalent when <tt>cl::CommaSeparated</tt> is specified:
+"<tt>-foo=a -foo=b -foo=c</tt>" and "<tt>-foo=a,b,c</tt>". This option only
+makes sense to be used in a case where the option is allowed to accept one or
+more values (i.e. it is a <a href="#cl::list">cl::list</a> option).<p>
+</ul>
+
+So far, the only miscellaneous option modifier is the
+<tt>cl::CommaSeparated</tt> modifier.<p>
+
+
<!-- ======================================================================= -->
</ul><table width="100%" bgcolor="#441188" border=0 cellpadding=4 cellspacing=0><tr><td> </td><td width="100%"> <font color="#EEEEFF" face="Georgia,Palatino"><b>
<a name="toplevel">Top-Level Classes and Functions
<address><a href="mailto:sabre@nondot.org">Chris Lattner</a></address>
<!-- Created: Tue Jan 23 15:19:28 CST 2001 -->
<!-- hhmts start -->
-Last modified: Wed Aug 7 13:22:40 CDT 2002
+Last modified: Sat Jun 21 16:45:29 CDT 2003
<!-- hhmts end -->
</font>
</body></html>