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

OptionSet.specs() seems to be broken if OptionParser.nonOptions() is set #73

Closed
lbergelson opened this Issue Jan 14, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@lbergelson
Contributor

lbergelson commented Jan 14, 2015

If you create an option parser with .nonOptions() the resulting OptionSet seems to have broken behavior.

OptionParser parser = new OptionParser();
parser.nonOptions();
String[] args = {"one","two"};
OptionSet options = parser.parse(args);

calling options.spec()

returns [ [[Arguments]], [[Arguments]]]

calling it again produces [[Arguments]]

third and subsequent times its an empty list;

This seems to be because the remove call in the .spec() implementation only removes the first instance of arguments, not all of them.

pholser added a commit that referenced this issue Jan 15, 2015

Merge pull request #74 from pholser/bug/73/option-parser-non-options-…
…vs-option-set-specs

For #73, ensure that OptionSet.specs() removes all non-option arg specs.
@pholser

This comment has been minimized.

Show comment
Hide comment
@pholser

pholser Jan 15, 2015

Collaborator

Thanks for catching this!

Collaborator

pholser commented Jan 15, 2015

Thanks for catching this!

@pholser pholser closed this Jan 15, 2015

@lbergelson

This comment has been minimized.

Show comment
Hide comment
@lbergelson

lbergelson Jan 15, 2015

Contributor

Quick turnaround 👍

Contributor

lbergelson commented Jan 15, 2015

Quick turnaround 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment