Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

Flags are strictly optional and don't obey the surrounding grammar #61

Closed
robotops opened this issue Jul 6, 2016 · 5 comments
Closed

Comments

@robotops
Copy link

robotops commented Jul 6, 2016

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.

Mutually-exclusive elements can be separated with a pipe "|" as follows:

Usage: my_program go (--up | --down | --left | --right)
Use parens "( )" to group elements when one of the mutually exclusive cases is required.

@felixSchl
Copy link
Owner

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.

@felixSchl
Copy link
Owner

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.

@felixSchl
Copy link
Owner

felixSchl commented Jul 9, 2016

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.

@felixSchl felixSchl added this to the Version 0.8.0 milestone Jul 13, 2016
@felixSchl
Copy link
Owner

felixSchl commented Jul 14, 2016

@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)

@felixSchl
Copy link
Owner

This feature has landed with v0.8.0 - ef429aa

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant