Regards #244: Explain how vectors of values allow repeated use of the same option on the command-line. (#247)

This commit is contained in:
Eyal Rozenberg 2020-07-23 09:36:54 +03:00 committed by GitHub
parent 9a454c8e4e
commit 1b660d5680
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -146,6 +146,22 @@ that can be parsed as a `std::vector<double>`:
--my_list=1,-2.1,3,4.5 --my_list=1,-2.1,3,4.5
~~~ ~~~
## Options specified multiple times
The same option can be specified several times, with different arguments, which will all
be recorded in order of appearance. An example:
~~~
--use train --use bus --use ferry
~~~
this is supported through the use of a vector of value for the option:
~~~
options.add_options()
("use", "Usable means of transport", cxxopts::value<std::vector<std::string>>())
~~~
## Custom help ## Custom help
The string after the program name on the first line of the help can be The string after the program name on the first line of the help can be