Skip to content

Commit 7051655

Browse files
committed
Clarify docs for 'zero_token'.
Fixes #1132. [SVN r67774]
1 parent 825562e commit 7051655

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

doc/overview.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ options_description desc;
181181
desc.add_options()
182182
("help", "produce help message")
183183
("compression", value<string>(), "compression level")
184-
("verbose", value<string>()->zero_tokens(), "verbosity level")
184+
("verbose", value<string>()->implicit_value("0"), "verbosity level")
185185
("email", value<string>()->multitoken(), "email to send to")
186186
;
187187
</programlisting>

include/boost/program_options/value_semantic.hpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,21 @@ namespace boost { namespace program_options {
261261
return this;
262262
}
263263

264-
/** Specifies that the value can span multiple tokens. */
264+
/** Specifies that the value can span multiple tokens.
265+
*/
265266
typed_value* multitoken()
266267
{
267268
m_multitoken = true;
268269
return this;
269270
}
270271

272+
/** Specifies that no tokens may be provided as the value of
273+
this option, which means that only presense of the option
274+
is significant. For such option to be useful, either the
275+
'validate' function should be specialized, or the
276+
'implicit_value' method should be also used. In most
277+
cases, you can use the 'bool_switch' function instead of
278+
using this method. */
271279
typed_value* zero_tokens()
272280
{
273281
m_zero_tokens = true;

src/cmdline.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ namespace boost { namespace program_options { namespace detail {
277277
}
278278

279279
/* If an key option is followed by a positional option,
280-
can can consume more tokens (e.g. it's multitoke option),
280+
can can consume more tokens (e.g. it's multitoken option),
281281
give those tokens to it. */
282282
vector<option> result2;
283283
for (unsigned i = 0; i < result.size(); ++i)

0 commit comments

Comments
 (0)