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

RequireOrder #5

Merged
merged 1 commit into from Dec 15, 2016
Merged

RequireOrder #5

merged 1 commit into from Dec 15, 2016

Conversation

tianon
Copy link
Contributor

@tianon tianon commented Oct 17, 2012

I've added a RequireOrder option that mimics the "require_order" configuration flag for Getopt::Long in Perl (http://perldoc.perl.org/Getopt/Long.html#require_order), which makes the module able to be more "POSIXLY_CORRECT", and opens up the possibility of doing partial processing (ala git itself having global git flags and then more local subcommand flags later on).

I think a very nice compliment to this option would be a way to specify an arbitrary slice to parse in place of os.Args so that this really could be run multiple times for subcommands and the like, although then we run into scoping issues of not wanting previously defined flags to be processed on the second run (which is why a commit for that change isn't included here also). A solution I would propose for that (and would love some dialog about) would be a "GoOpt" struct/object that contains all the options parsing but includes a backwards-compatible interface that just uses a shared object. If you like the idea, I'd really enjoy implementing such a thing and sending another pull request when it is complete.

This option mimics the "require_order" configuration flag for Getopt::Long in Perl (http://perldoc.perl.org/Getopt/Long.html#require_order), which makes the module able to be more "POSIXLY_CORRECT", and opens up the possibility of doing partial processing (ala git itself having global git flags and then more local subcommand flags later on).
@droundy droundy merged commit 7c1d66c into droundy:master Dec 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants