Skip to content
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

List flags #36

Open
nyarly opened this issue Aug 4, 2016 · 4 comments
Open

List flags #36

nyarly opened this issue Aug 4, 2016 · 4 comments

Comments

@nyarly
Copy link

nyarly commented Aug 4, 2016

I was recently surprised to discover that while arguments can be repeated, flags cannot. e.g. these are acceptable docstrings, but they don't behave as expected:

-v  verbose (specify multiple times for more verbose)
-x=<pattern>...  exclude files that match <pattern>

Neither of these cases seem to be addressed, although they're pretty common. The "verbose" case I kind of understand, since it'd take some kind of docstring magic to indicate to the parse what's meant. But the "exclude" seems to fall within the documentation as written for docopt, and instead returns a parsing error.

@nyarly
Copy link
Author

nyarly commented Aug 4, 2016

This is effectively "can we have docopt/docopt#275 ?"

@gdey
Copy link

gdey commented Aug 17, 2016

This duplicates issue #29

@nyarly
Copy link
Author

nyarly commented Aug 17, 2016

@gdey I don't agree. #29 is about having the same flag documented twice to mean different things in different contexts. I think that's maybe reasonable and not too difficult if the flag always is the same kind.

This is about accepting -vvvv => map[string]interface{}{"v": 4} or -x=bad -x=worse => {"x": []string{"bad","worse"}

@fenollp
Copy link

fenollp commented Jan 23, 2018

Note @nyarly : -vvvv returns "-v": 4 or 3 or2 or 1 or 0 if omitted. This works; haven't tried the other one.

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

No branches or pull requests

3 participants