-
Notifications
You must be signed in to change notification settings - Fork 591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multitoken options #444
base: master
Are you sure you want to change the base?
Multitoken options #444
Conversation
I'll have to get back to you on this one, I haven't forgotten it, but I can't comment further right now. |
I wonder if it is worth putting some help text in to let users know that something is a multitoken option. Other than that this looks good. |
Missing multitoken support is also the last bit preventing me from completely ditching boost program_options and switching to cxxopts fully. Would be really nice to have this. I'm assuming this would also work with |
The command-line argument syntax of generate-obj slightly changed: Coefficient values now need to be separated by a comma instead of spaces, e.g. `generate.obj.exe --model ... --shape-coefficients 1.0,-1.5`. If cxxopts merge jarro2783/cxxopts#444, we could potentially use their multitoken option - but I think the syntax is fine now as it is.
@jarro2783 I was just going by the Boost implementation which doesn't change the help text for the parameter, but if you would like to add a help text that's fine by me since it shouldn't affect backwards compatibility. @patrikhuber Yes, float works as well. Multitoken options use the same |
I'm not too fussed, I thought it might be good so that it is immediately obvious to the users of your program. |
Can you write a unit test? |
Implements multitoken options from Boost.Program_options. A multitoken option will take values until the next option is given. This makes it possible to switch to cxxopts without breaking backwards compatibility for multitoken options, and also enables a slightly easier syntax for the user for options with multiple values.
Example code without multitoken which just takes multiple parameters and prints them:
Applying multitoken to option
-c
while keeping-b
as is:will now cause option
-c
to take values until the next option is given:This change is