From 9431d034372f7f3319fb197eddca4d0b8b7406e0 Mon Sep 17 00:00:00 2001 From: Blake-Madden <66873089+Blake-Madden@users.noreply.github.com> Date: Wed, 16 Jul 2025 04:09:19 -0400 Subject: [PATCH] Explain how to include spaces in list of arguments (#461) --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 603e435..fae283b 100644 --- a/README.md +++ b/README.md @@ -195,14 +195,23 @@ therefore, `-o false` does not work. Parsing a list of values into a `std::vector` 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`: ~~~ --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