-
Notifications
You must be signed in to change notification settings - Fork 991
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
.count misbehaves with hyphenated flags #256
Comments
Hey @kahlil what version of yargs are you running, I can't seem to reproduce: #!/usr/bin/env node
var opts = require('./')
.count('log-level')
.alias('l', 'log-level')
.argv;
console.log(opts); Benjamins-MacBook-Pro:yargs benjamincoe$ ./test.js -llll
{ _: [], l: 4, 'log-level': 4, logLevel: 4, '$0': 'test.js' } |
Sorry, this is probably related to gulp-cli, which is on a super old version (1.3.3). I am working on updating it now. |
Ref #78 |
Oops, @phated is right. I did not check the version! Sorry for this 🙏 |
Closing based on previous comments. If you find another problem, please open a new issue. Thanks! |
With version 3.30.0:
With .options, the count is always 2 more than it should be. Using:
everything seems to work fine. |
Actually, it's the |
@hildjj Thanks for pointing this out! |
Perhaps a warning/error, then, if you specify both? Starting the count at 2 was unexpected behavior. |
@hildjj Agreed. Would you mind creating a new ticket for that? |
If I do something like this:
And pass
-lll
yargs will always count 2 no matter what. If I useloglevel
as the main name of the flag it counts them correctly.The text was updated successfully, but these errors were encountered: