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

Inconsistent parsing of arrays with dot-notation when argument order is switched #101

Closed
elsbree opened this issue Sep 1, 2017 · 2 comments

Comments

@elsbree
Copy link
Contributor

elsbree commented Sep 1, 2017

The way an array argument is parsed changes depending on whether I parse --config.compression=store --config ./electron.config.json vs. --config ./electron.config.json --config.compression=store

When I run:

var argv = require("yargs-parser")('--config.compression=store --config ./electron.config.json')

The value of argv.compression is

[
  {
    "compression": "store"
  },
  "./electron.config.json"
]

But when I swap the arguments and run:

var argv = require("yargs-parser")('--config ./electron.config.json --config.compression=store')

The value of argv.compression is

"\"./electron.config.json\""

I would expect them both to equal the result of the first command. Is there a reason for this, or is it a bug?

@bcoe
Copy link
Member

bcoe commented Sep 3, 2017

@elsbree this definitely feels like a bug! thanks for reporting. If you have any interested in fixing this yourself, feel free to join our community slack. And I'd be happy to give direction.

Either way we'll hopefully fix this for you relatively soon as we work through our backlog of issues.

@elsbree
Copy link
Contributor Author

elsbree commented Sep 5, 2017

Thanks! I'm working on a PR now.

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

2 participants