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

Add option to allow coercion of array items #132

Merged
merged 3 commits into from
Oct 6, 2018

Conversation

iilei
Copy link
Contributor

@iilei iilei commented Aug 22, 2018

Fixes #6

@bcoe
Copy link
Member

bcoe commented Oct 6, 2018

@iilei this is awesome \o/ could I bother you to rebase?

Also, I apologize for the slow turnaround; it's hard to keep on top of open-source and all the exciting things happening at npm, Inc at the same time these days.

A good place to chat with me is here, if my turn around is ever slow. A few folks who build node tooling are attempting to pull together a community around the needs of the developer tools community.

@iilei
Copy link
Contributor Author

iilei commented Oct 6, 2018

Rebase in progress

@iilei iilei force-pushed the optional_type_param_for_arrays branch from 22efc7b to 2bc2bd4 Compare October 6, 2018 20:28
@bcoe
Copy link
Member

bcoe commented Oct 6, 2018

@iilei 👍 let me know when this is ready to land; I'm going to make this a BREAKING CHANGE, FYI; since I think it's a change to yargs' contract (albeit a good one).

@iilei iilei force-pushed the optional_type_param_for_arrays branch from eb42a2a to 348b99c Compare October 6, 2018 21:08
@iilei
Copy link
Contributor Author

iilei commented Oct 6, 2018

@bcoe from my point of view it can be merged 👍

@bcoe bcoe merged commit 4b8cfce into yargs:master Oct 6, 2018
@bcoe
Copy link
Member

bcoe commented Oct 6, 2018

@iilei likewise, try this out with yargs@next 👍 thank you for your contributions.

@iilei
Copy link
Contributor Author

iilei commented Oct 7, 2018

I am currently investigating on an issue if there is a combination of multiple arrays, configured differently.

Please let me take some time to get this sorted out.

@iilei
Copy link
Contributor Author

iilei commented Oct 7, 2018

@bcoe I figured that the issue mentioned above is not due to my patch but also exists with version 12.0.2.

Therefor, this patch is tested and true

@garyking
Copy link

Could someone explain how this option can be used with this:

yargs.option('items', {
  alias: 'i',
  type: 'array',
  default: []
})

To coerce the array items to strings, even if something like node script.js -i 123 is passed?

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.

array options should accept optional type parameter
3 participants