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

feat: should we provide a way for folks to filter whether or not an argument should be appended to an array #219

Open
laggingreflex opened this issue Dec 15, 2016 · 2 comments

Comments

@laggingreflex
Copy link
Contributor

If you have a flag that takes an array, how to make it differentiate between the values that it's supposed take and those that should just be positional arguments?

For Eg.:

create-index --filetype .js .jsx ./src

Here filetype should only take .js .jsx and ./src should be a positional argument.

It seems this isn't currently possible, right? I haven't come across this kind of use case before so I'm not sure what should the solution to this be. Is this something that should even be solved at yargs level, or should the end-user just be advised to use the cli in a way to avoid this issue altogether (create-index ./src --filetype .js .jsx)

@acwest
Copy link

acwest commented Oct 1, 2017

I have found (in version 9.0.1) that array parsing appears to return an array containing null if any other positional arguments are present

@bcoe bcoe transferred this issue from yargs/yargs Nov 10, 2019
@bcoe
Copy link
Member

bcoe commented Nov 10, 2019

moved to yargs-parser 👍

@bcoe bcoe changed the title Flags that take array preceeded by positional arguments feat: should we provide a way for folks to filter whether or not an argument should be appended to an array Feb 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants