Skip to content

Commit cc76c94

Browse files
committed
update whitespace on book chapter
1 parent f750305 commit cc76c94

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

book/chapters/options.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,15 @@ Windows style options do not allow combining short options or values not separat
165165

166166
## Parse configuration
167167

168-
How an option and its arguments are parsed depends on a set of controls that are part of the option structure. In most circumstances these controls are set automatically based on the function used to create the option and the type the arguments are parsed into. The variables define the size of the underlying type (essentially how many strings make up the type), the expected size (how many groups are expected) and a flag indicating if multiple groups are allowed with a single option. And these interact with the `multi_option_policy` when it comes time to parse.
168+
How an option and its arguments are parsed depends on a set of controls that are part of the option structure. In most circumstances these controls are set automatically based on the function used to create the option and the type the arguments are parsed into. The variables define the size of the underlying type (essentially how many strings make up the type), the expected size (how many groups are expected) and a flag indicating if multiple groups are allowed with a single option. And these interact with the `multi_option_policy` when it comes time to parse.
169169

170170
### examples
171171
How options manage this is best illustrated through some examples
172172
```cpp
173173
std::string val;
174174
app.add_option("--opt",val,"description");
175175
```
176-
creates an option that assigns a value to a `std::string` When this option is constructed it sets a type_size of 1. meaning that the assignment uses a single string. The Expected size is also set to 1 by default, and `allow_extra_args` is set to false. meaning that each time this option is called 1 argument is expected. This would also be the case if val were a `double`, `int` or any other single argument types.
176+
creates an option that assigns a value to a `std::string` When this option is constructed it sets a type_size of 1. meaning that the assignment uses a single string. The Expected size is also set to 1 by default, and `allow_extra_args` is set to false. meaning that each time this option is called 1 argument is expected. This would also be the case if val were a `double`, `int` or any other single argument types.
177177

178178
now for example
179179
```cpp
@@ -188,20 +188,20 @@ std::vector<int> val;
188188
app.add_option("--opt",val,"description");
189189
```
190190

191-
detects a type size of 1, since the underlying element type is a single string, so the minimum number of strings is 1. But since it is a vector the expected number can be very big. The default for a vector is (1<<30), and the allow_extra_args is set to true. This means that at least 1 argument is expected to follow the option, but arbitrary numbers of arguments may follow. These are checked if they have the form of an option but if not they are added to the argument.
191+
detects a type size of 1, since the underlying element type is a single string, so the minimum number of strings is 1. But since it is a vector the expected number can be very big. The default for a vector is (1<<30), and the allow_extra_args is set to true. This means that at least 1 argument is expected to follow the option, but arbitrary numbers of arguments may follow. These are checked if they have the form of an option but if not they are added to the argument.
192192

193193
```cpp
194194
std::vector<std::tuple<int, double, std::string>> val;
195195
app.add_option("--opt",val,"description");
196196
```
197-
gets into the complicated cases where the type size is now 3. and the expected max is set to a large number and `allow_extra_args` is set to true. In this case at least 3 arguments are required to follow the option, and subsequent groups must come in groups of three, otherwise an error will result.
197+
gets into the complicated cases where the type size is now 3. and the expected max is set to a large number and `allow_extra_args` is set to true. In this case at least 3 arguments are required to follow the option, and subsequent groups must come in groups of three, otherwise an error will result.
198198

199199
```cpp
200200
bool val;
201201
app.add_flag("--opt",val,"description");
202202
```
203203

204-
Using the add_flag methods for creating options creates an option with an expected size of 0, implying no arguments can be passed.
204+
Using the add_flag methods for creating options creates an option with an expected size of 0, implying no arguments can be passed.
205205

206206
### Customization
207207

@@ -212,7 +212,7 @@ std::string val;
212212
auto opt=app.add_flag("--opt{vvv}",val,"description");
213213
opt->expected(0,1);
214214
```
215-
will create a hybrid option, that can exist on its own in which case the value "vvv" is used or if a value is given that value will be used.
215+
will create a hybrid option, that can exist on its own in which case the value "vvv" is used or if a value is given that value will be used.
216216
217217
[^1]: For example, enums are not printable to `std::cout`.
218218
[^2]: There is a small difference. An combined unlimited option will not prioritize over a positional that could still accept values.

0 commit comments

Comments
 (0)