docopt.cpp
                                
                                 docopt.cpp copied to clipboard
                                
                                    docopt.cpp copied to clipboard
                            
                            
                            
                        Define validation or possible values for the value of an option
Fiven the following usage string:
Usage:
  vrplayer-openvr [--option VALUE]
Options:
  --option VALUE  Set of options (first|second|third) [default: first]
Is it possible to validate a set of options (see the values in the parenthesis.
Could it be written also as:
  --option VALUE  Set of options [values: first|second|third, default: first]
If not possible, then its a feature request.
What is expected is that the parser also restrict the used option value (and throws if invalid). In the my example, I have a pipe list, but actually could it be a regex?
Any comment on this?
Related: https://github.com/docopt/docopt/issues/45
No, the syntax doesn't have any way to do this .. it would be up to you to provide that kind of validation when you look at the values you get. I think trying to adjust the syntax would be tricky to do.
What about syntax proposed above by @isometriq ?
  --option VALUE  Description… [values: first|second|third, default: first]
Looking in the man pages for git, I think a better syntax would be:
--diff-algorithm={patience|minimal|histogram|myers}
I think this could be a nice addition, however this library tries to conform to the "standard" put forth by the peer project and original "Docopt" in Python. So before I could adopt this, it would need to be proposed and implemented in the original.