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

feature: add stopEarly option #41

Merged
merged 2 commits into from
Nov 2, 2018
Merged

feature: add stopEarly option #41

merged 2 commits into from
Nov 2, 2018

Conversation

jorgebucaran
Copy link
Owner

Add new stopEarly boolean property to the configuration options. If true, the operands array _ will be populated with all the arguments after the first non-option.

getopts(["-w9", "alpha", "--turbo", "beta"], {
  stopEarly: true
}) //=> { _:["alpha", "--turbo", "beta"], w:9 }

This property is useful when implementing sub-commands in a CLI as described by @julien-f in #40.

@jorgebucaran jorgebucaran added the enhancement New feature or request label Oct 26, 2018
@jorgebucaran jorgebucaran changed the title feature: add stopEarly option; close #40 feature: add stopEarly option Oct 26, 2018
@codecov-io
Copy link

codecov-io commented Oct 26, 2018

Codecov Report

Merging #41 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #41   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           1      1           
  Lines          92     94    +2     
=====================================
+ Hits           92     94    +2
Impacted Files Coverage Δ
index.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d94fccd...da011f3. Read the comment docs.

@jorgebucaran
Copy link
Owner Author

@julien-f What do you think about the example I added to the docs? Could it be improved?

@julien-f
Copy link

Looks fine to me 🙂

@jorgebucaran jorgebucaran merged commit f6cc607 into master Nov 2, 2018
@jorgebucaran jorgebucaran deleted the stop-early branch November 2, 2018 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants