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

Single-digit booleans not working as intended with "short-option-groups" set to false #312

Open
Stefouch opened this issue Aug 27, 2020 · 1 comment

Comments

@Stefouch
Copy link

"short-option-groups": false,
"unknown-options-as-args": true

With this configuration, single-digit booleans like -1 are still parsed.

It's an issue because I can't have that -1 passing into the ._ array of args while not using "short-option-groups".

@shadowspawn
Copy link
Member

There is special handling for numbers, with the assumption that it is more likely they are numbers than short options. There isn't a way to turn this off. Is this what you are asking about?

const argv = require('yargs-parser')(process.argv.slice(2)});
console.log(argv);
% node index.js -ab -c1 -d-2 -3
{ _: [ -3 ], a: true, b: true, c: 1, d: -2 }

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