Skip to content

Conversation

boneskull
Copy link
Contributor

@boneskull boneskull commented Nov 19, 2018

This reverts commit 77ae1d4.

Prior to this commit, those wishing to require that an array-type option has a nonzero amount of arguments could use the check() function for validation.

The commit removed the ability to use nargs in conjunction with array-type options.

After this commit, those wishing to limit the number of values an array-type option accepts have no viable workaround. This also has the implication that such an option cannot be used prior to a positional option, because it's ambiguous:

# usage: script [--foo n1 n2] <stuff>
$ script --foo bar baz quux
# `quux` should be `stuff`, but because `foo` is an array, it eats up `quux`.

UPDATE: Previous to #136, the above example was still an issue, but nargs(1) or requireArg() was a viable workaround; it no longer is.

@boneskull
Copy link
Contributor Author

boneskull commented Nov 19, 2018

@vmx looks like @bcoe will be landing this since #136 introduces problems. I'll let him chime in, but you won't be left high & dry--it sounds like he'll have something to address your use case in the near future.

@bcoe
Copy link
Member

bcoe commented Nov 19, 2018

@vmx see my comments in #136, this is only a temporary revert.

@bcoe bcoe merged commit f4a3063 into yargs:master Nov 19, 2018
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.

2 participants