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

Reset arg if it was a switch and not an argument #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sabberworm
Copy link
Contributor

The following:

var parser = new OptionParser([['-e', '--example [STRING]']]);
parser.parse(['--example', '--help']);

passes "--help" as arg to the example handler even though the --help switch will be handled later on. This patch fixes this and passes undefined to the example handler function.

Note: merging this will most likely conflict with pull request #14. Ultimately it should not make much difference whether you put the arg = undefined; inside or below the if block.

@sabberworm
Copy link
Contributor Author

I’ve rebased this pull request atop the current master so it should be fine to merge automatically.

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

Successfully merging this pull request may close these issues.

1 participant