Commit 1b660d56801283905b0f0fdd43e7e7ba3c5c396e

Authored by Eyal Rozenberg
Committed by GitHub
1 parent 9a454c8e

Regards #244: Explain how vectors of values allow repeated use of the same optio…

…n on the command-line. (#247)
Showing 1 changed file with 16 additions and 0 deletions
README.md
@@ -146,6 +146,22 @@ that can be parsed as a `std::vector<double>`: @@ -146,6 +146,22 @@ that can be parsed as a `std::vector<double>`:
146 --my_list=1,-2.1,3,4.5 146 --my_list=1,-2.1,3,4.5
147 ~~~ 147 ~~~
148 148
  149 +## Options specified multiple times
  150 +
  151 +The same option can be specified several times, with different arguments, which will all
  152 +be recorded in order of appearance. An example:
  153 +
  154 +~~~
  155 +--use train --use bus --use ferry
  156 +~~~
  157 +
  158 +this is supported through the use of a vector of value for the option:
  159 +
  160 +~~~
  161 +options.add_options()
  162 + ("use", "Usable means of transport", cxxopts::value<std::vector<std::string>>())
  163 +~~~
  164 +
149 ## Custom help 165 ## Custom help
150 166
151 The string after the program name on the first line of the help can be 167 The string after the program name on the first line of the help can be