Lines Matching full:option
15 for the option declared (of course this `can be changed`_).
56 Simply specify the parser that you want to use with the command line option
61 ``-help`` option that shows the available command line options for your tool.
103 for every command line option that you would like to support, there should be a
105 we would like to support the Unix-standard '``-o <filename>``' option to specify
118 simple scalar option by using the "``cl::opt``" template (as opposed to the
123 output for the "``-help``" option. In this case, we get a line that looks like
134 Because we specified that the command line option should parse using the
147 option handling library, but the above example shows the general interface to
158 line parameters that are not in option form. We use this feature like this:
166 as the input filename. Here we use the `cl::init`_ option to specify an initial
167 value for the command line option, which is used if the option is not specified
168 (if you do not specify a `cl::init`_ modifier for an option, then the default
187 of the command line option verification code out of your application into the
189 behaviour of the library, on a per-option basis. By adding one of the
190 declarations above, the ``-help`` option synopsis is now extended to:
219 that the "``-q``" option is specified with the "`cl::Hidden`_" flag. This
224 For example, in the string case, the argument passed to the option is copied
271 the CommandLine library also provides primitives to support CommandLine option
289 condition, we can use the "`cl::alias`_" class to make the "``-q``" option an
290 **alias** for the "``-quiet``" option, instead of providing a value itself:
371 line arguments matched the enum values. With this option added, our help output
425 optimization level flags, but we also specify an option name. For this case,
445 the "``-help``" option:
468 an option name (``"debug_level"``), which automatically changes how the library
543 bit is set in the option's bit vector:
581 **type** ``unsigned``. In all other ways a `cl::bits`_ option is equivalent to a
582 `cl::list`_ option.
628 can put our options into categories. This can be done by declaring option
630 these categories using the `cl::cat`_ option attribute. For example:
643 The output of ``-help`` will become categorized if an option category is
663 In addition to the behaviour of ``-help`` changing when an option category is
664 declared, the command line option ``-help-list`` becomes visible which will
677 work, as well as information on more "advanced" command line option processing
690 specified with a hyphen. Positional arguments should be used when an option is
701 Given these two option declarations, the ``-help`` output for our grep
735 grep: illegal option -- f
736 grep: illegal option -- o
737 grep: illegal option -- o
754 Sometimes an option can affect or modify the meaning of another option. For
755 example, consider ``gcc``'s ``-x LANG`` option. This tells ``gcc`` to ignore the
805 ``unsigned getPosition()`` option that will provide the absolute position of
806 that option. You can apply the same approach as above with a ``cl::opt`` and a
807 ``cl::list`` option as you can with two lists.
816 The ``cl::ConsumeAfter`` `formatting option`_ is used to construct programs that
817 use "interpreter style" option processing. With this style of option
826 arguments to the script are parsed by the Bourne shell command line option
855 not be any `cl::list`_ positional arguments, and the ``cl::ConsumeAfter`` option
856 should be a `cl::list`_ option.
869 Sometimes, however, it is nice to separate the command line option processing
871 '``-debug``' option that we would like to use to enable debug information across
874 command line option processing code should not be exposed to all of these
877 To do this, set up your .h file with your option, like this for example:
881 // DebugFlag.h - Get access to the '-debug' command line option
884 // DebugFlag - This boolean is set to true if the '-debug' command line option
891 // In the '-debug' option is specified on the command line, and if this is a
892 // debug build, then the code specified as the option to the macro will be
902 the ``DebugFlag`` boolean when the option is set. To do this, we pass an
917 Option Attributes
922 * The option name attribute (which is required for all options, except
923 `positional options`_) specifies what the option name is. This option is
932 * The **cl::desc** attribute specifies a description for the option to be
939 fine tune the ``-help`` output for a command line option. Look `here`_ for an
945 option. If this attribute is not specified then the command line option value
951 If you specify both **cl::init** and **cl::location** for an option, you
959 line option if using external storage. See the section on `Internal vs
964 * The **cl::aliasopt** attribute specifies which option a `cl::alias`_ option is
971 (option, value, description) triplets that specify the option name, the value
977 for an enum. This macro automatically makes the option name be the same as
978 the enum name. The first option to the macro is the enum, the second is
979 the description for the command line option.
981 #. The **clEnumValN** macro is used to specify macro options where the option
991 * The **cl::multi_val** attribute specifies that this option takes has multiple
993 takes one unsigned argument - the number of values for the option. This
995 error if you try to use it with other option types). It is allowed to use all
1001 * The **cl::cat** attribute specifies the option category that the option
1004 Option Modifiers
1007 Option modifiers are the flags and expressions that you pass into the
1014 #. Hiding an option from ``-help`` output
1022 #. Miscellaneous option modifiers
1025 runtime error) to a single option, except for options in the miscellaneous
1030 Hiding an option from ``-help`` output
1034 used to control whether or not an option appears in the ``-help`` and
1040 `cl::list`_ options) indicates the option is to appear in both help
1046 indicates that the option should not appear in the ``-help`` output, but
1051 * The **cl::ReallyHidden** modifier indicates that the option should not appear
1057 This group of options is used to control how many time an option is allowed (or
1062 The allowed values for this option group are:
1068 one occurrence of the option to be specified.
1073 class) indicates that your program will allow the option to be specified zero
1078 * The **cl::Required** modifier indicates that the specified option must be
1083 * The **cl::OneOrMore** modifier indicates that the option must be specified at
1089 If an option is not specified, then the value of the option is equal to the
1091 not specified, the option value is initialized with the default constructor for
1094 If an option is specified multiple times for an option of the `cl::opt`_ class,
1100 This group of options is used to control whether or not the option allows a
1105 The allowed values for this option group are:
1112 an explicit '``-foo=true``'. If an option is specified with this mode, it is
1122 option is not provides with an equal sign, that the next argument provided
1132 In general, the default values for this option group work just like you would
1137 .. _formatting option:
1142 The formatting option group is used to specify that the command line option has
1149 specifies that this option is "normal".
1154 that does not have a command line option associated with it. See the
1157 * The **cl::ConsumeAfter** modifier specifies that this option is used to
1164 * The **cl::Prefix** modifier specifies that this option prefixes its value.
1166 option name specified. Instead, the value is everything after the prefix,
1190 option into (potentially multiple) prefix and grouping options. The strategy
1198 2. if (isOption(input)) return getOption(input).parse(); // Normal option
1200 4. if (input.empty()) return error(); // No matching option
1213 Miscellaneous option modifiers
1216 The miscellaneous option modifiers are the only flags where you can specify more
1218 specify boolean properties that modify the option.
1223 option's value should be used to split the value up into multiple values for
1224 the option. For example, these two options are equivalent when
1226 "``-foo=a,b,c``". This option
1227 option is allowed to accept one or more values (i.e. it is a `cl::list`_
1228 option).
1238 be applied to the "``-pos1``" option and the "``-bork``" string to be applied
1239 to the "``-pos2``" option.
1244 least one option with ``cl::Sink`` modifier specified, the parser passes
1245 unrecognized option strings to it as values instead of signaling an error. As
1247 option.
1249 So far, these are the only three miscellaneous option modifiers.
1268 Despite all of the built-in flexibility, the CommandLine option library really
1288 The function retrieves a :ref:`StringMap <dss_stringmap>` that maps the option
1289 string (e.g. ``-help``) to an ``Option*``.
1299 StringMap<cl::Option*> Map;
1302 //Unhide useful option and put it in a different category
1307 //Hide an option we don't want to see
1331 option variables once ``argc`` and ``argv`` are available.
1335 `additional extra text`_ to emit when the ``-help`` option is invoked, and a
1347 command line option variables just like `cl::ParseCommandLineOptions`_ does.
1352 ``-help`` option is invoked, and the boolean switch that controls whether
1358 an environment variable containing ``-option "foo bar"`` will be parsed as three
1359 words, ``-option``, ``"foo``, and ``bar"``, which is different from what you
1368 option instead of having the ``CommandLine`` library print out the usual version
1374 the ``--version`` option is given by the user.
1397 template argument is used to specify whether the option should contain the
1398 storage for the option (the default) or whether external storage should be used
1399 to contain the value parsed for the option (see `Internal vs External Storage`_
1404 type of the option. In general, this default works well for most applications,
1405 so this option is only used when using a `custom parser`_.
1463 The `cl::aliasopt`_ attribute should be used to specify which option this is an
1473 to be printed out for the ``-help`` option.
1500 option categories.
1508 An option category must have a name and optionally a description which are
1511 Note that declaring an option category and associating it with an option before
1513 uncategorized to categorized. If an option category is declared but not
1514 associated with an option then it will be hidden from the output of ``-help``
1526 option specifies that it uses values of type '``type``'. Because of this,
1527 custom option processing is specified with specializations of the '``parser``'
1554 is boolean, but we also need to know whether the option was specified at all.
1610 automatically use your custom parser whenever they define an option with a
1618 option using special syntax for a not-very-special data-type. The drawback
1635 bool parse(cl::Option &O, const char *ArgName, const std::string &ArgValue,
1646 is the ``parse`` method. The ``parse`` method is called whenever the option is
1647 invoked, passing in the option itself, the option name, the string to parse, and
1655 bool FileSizeParser::parse(cl::Option &O, const char *ArgName,
1683 it is good enough for this example. Note that we use the option itself to print
1715 -max-file-size option: 'dog' value invalid for file size argument!
1727 line option outside of the library. In these cases the library does or should