docopt.cpp
docopt.cpp copied to clipboard
How do I set up the options to take optional values?
I might not quite understand the documentation correctly but, suppose I want to set a certain quality to a default level if an option is not passed to the application, a different default value if the option is passed with no arguments, and a third value if the option is passed with certain arguments?
I dont think this is possible because I'm not sure how you would express that in documentation in a way that is understandable to the docopt algorithm. Do you have any ideas?
Not immediately, no. That's why I asked.
I think #72 is talking about the same feature request and mentions an example
maybe like this?
[default: (.*), implicit: (.*)]
(in the Options: block)
I would like validation too: https://github.com/docopt/docopt.cpp/issues/86
Maybe like this ?
Options:
--always_set=[<n>] This has the current behaviour [default: 10].
--always_set This implicitly sets the value to 5 [value: 5]