mirror of
https://github.com/jarro2783/cxxopts.git
synced 2026-01-18 01:11:24 +01:00
Explain how to include spaces in list of arguments (#461)
This commit is contained in:
13
README.md
13
README.md
@@ -195,14 +195,23 @@ therefore, `-o false` does not work.
|
||||
|
||||
Parsing a list of values into a `std::vector<T>` is also supported, as long as `T`
|
||||
can be parsed. To separate single values in a list the define symbol `CXXOPTS_VECTOR_DELIMITER`
|
||||
is used, which is ',' by default. Ensure that you use no whitespaces between values because
|
||||
those would be interpreted as the next command line option. Example for a command line option
|
||||
is used, which is ',' by default. Ensure that you use no whitespaces between values
|
||||
(unless the entire list is double quoted) because those would be interpreted as the
|
||||
next command line option. Example for a command line option
|
||||
that can be parsed as a `std::vector<double>`:
|
||||
|
||||
~~~
|
||||
--my_list=1,-2.1,3,4.5
|
||||
~~~
|
||||
|
||||
If the list of values is quoted, then spaces can be included. For example:
|
||||
|
||||
~~~
|
||||
--my_list="review,memory sanitize,build help,reformat"
|
||||
~~~
|
||||
|
||||
This will be parsed into `review`, `memory sanitize`, `build help`, and `reformat`.
|
||||
|
||||
## Options specified multiple times
|
||||
|
||||
The same option can be specified several times, with different arguments, which will all
|
||||
|
||||
Reference in New Issue
Block a user