From 28e5f38a7c692e7db920919efe81b7d31a2d243f Mon Sep 17 00:00:00 2001 From: Eyal Rozenberg Date: Wed, 22 Jul 2020 10:27:30 +0300 Subject: [PATCH] Regards #244: Explain how vectors of values allow repeated use of the same option on the command-line. --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index f157052..88b92d4 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,22 @@ that can be parsed as a `std::vector`: --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>()) +~~~ + ## Custom help The string after the program name on the first line of the help can be