Closed robotops closed 8 years ago
I am working on a feature branch feature/required-flags that will introduce an option requireFlags
that will cause the desired behaviour. I am open for a discussion wether or not that should be the default behaviour for neodoc. For the time being it is opt-in.
The branch is coming along nicely and it had the positive side effect that error messages got more love, since in the context of missing flags, they left a lot to be desired off. For example, instead of saying that a group in it's entirety failed, it will track the reason and print that reason. Further, it makes now a distinction between missing arguments and unmet expectations (got '-a' in place of '-b'). But I digress. I will see to have a npm-tagged prerelease to play with later today.
There's a tagged release available if you'd like to give it a go. Any feedback would be very welcome - just do npm i neodoc@required-flags
. Please let me know if the behaviour is as you'd expect and if the error messages are sufficiently helpful.
@robotops you can try the new behaviour now at https://felixschl.github.io/neodoc (it's running a preview version of v0.8.0. feedback would be much appreciated)
This feature has landed with v0.8.0 - ef429aa37eaa51c45485af071aacef618a9fb29f
Flags are considered to be strictly optional despite the surrounding grammar. For instance, the following example documented on http://docopt.org/ does not enforce the requirement that one of the mutually exclusive flags be provided.