Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow optional non-Optimist argv. #12

Merged
merged 1 commit into from
May 19, 2013

Conversation

evocateur
Copy link
Contributor

This allows other arg parsers (e.g., nopt or any other argument parser that gives you a hash of options) to provide the argv that rc consumes. If no custom argv are provided, it trundles along as before with optimist.

@dominictarr
Copy link
Owner

The way this integrates is clean, but I'm not certain what nopt does that optimist doesn't.

What about nopt sold you?

@evocateur
Copy link
Contributor Author

Other than "I was already using it, and don't want to migrate to optimist":

  • Specifying parameters that are always Arrays, even with a single value: { "stuff": [path, Array] }
  • Specifying parameters of an explicit type, or array of types, with the first success determining the choice: { "stringOrDate": [Date, String] }
  • Shorthands that expand to composite longhands: { "s": ["--stuff", "--things", "foo"] }

Also, as @isaacs noted, type verification and custom parsing capabilities.

@dominictarr
Copy link
Owner

After much reflection (noting the way that nopt parses options when using npm, and asking myself what would it be like with optimist?) I have decided to merge this.

dominictarr added a commit that referenced this pull request May 19, 2013
Allow optional non-Optimist argv.
@dominictarr dominictarr merged commit 155b851 into dominictarr:master May 19, 2013
@dominictarr
Copy link
Owner

merged into rc@0.2.0

@evocateur
Copy link
Contributor Author

Thanks!

@evocateur evocateur deleted the argv-param branch May 20, 2013 19:16
@dominictarr dominictarr mentioned this pull request Dec 27, 2013
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants