Explain how to include spaces in list of arguments (#461)

This commit is contained in:
Blake-Madden
2025-07-16 04:09:19 -04:00
committed by GitHub
parent 44380e5a44
commit 9431d03437

View File

@@ -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