-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Regression in the command line parsing #1673
Comments
Sounds related to yargs/yargs#465 TL;DR there's a parser option duplicate-arguments-array we can play with to see if we can get the original behaviour back. |
Verified that the following resolves the regression:
|
- added a test to demonstrate the regression - use duplicate-arguments-array, which correctly handles --amd --no-amd - unfortunately this breaks all other valid multi-keys like -k for known helpers :(
- added a test to demonstrate the regression - use duplicate-arguments-array, which correctly handles --amd --no-amd - unfortunately this breaks all other valid multi-keys like -k for known helpers :(
Ok so I've had a go at trying to fix the issue #1674, but this parser config option is too heavy handed. I wonder if @bcoe could provide some advice here on whether there's some other option I've missed, or if not, what a possible way forward might be, e.g. adding a new parser option? Can maybe move this discussion over to yargs. Either way the problem is now only on master, is tracked, and we're not in a hurry to release. I guess it would also be OK to ship with this as a breaking change, but I think we'd all prefer not to. |
👋 I think we fixed a bug for this in yargs@16, I can backport it to 14 this weekend if that helps. |
@bcoe Oooooh if you can confirm it's fixed in 16 that's 👌 perfect. We've only got yargs on master now and only need support for Node v10 there :) |
Yea, I was going to mention the same thing: master likely has no reason to not be on yargs 16, so if that works for everyone, then better all-around 🥂 |
Just tested and it works in 15 🙌 , bumping now 👍 |
- demonstrates the regression
fixes handlebars-lang#1673 - we no longer need to pin to yargs 14 for node 6 & 8 support
@ErisDS @dougwilson let me know if it still causes issues, and I can add a unit tests (I just seem to remember a fix around this, but might not be fully understanding). |
Seems to be fixed to me. @dougwilson lemme know if you find any more issues like this 👍 |
I have been working to upgrade to the latest handlebars where I can (environment supports it), and I ran into an error and tracked it down to a regression in the handling of command line arguments when the same boolean was specified more than once.
For example, in version 4.7.3 and below,
handlebars --amd --no-amd
would result in the standard output, but in 4.7.4 and 4.7.5 it ends up resulting in AMD output, as if the--no-amd
was not there.The is appearing in some complex tooling internally where we have "default arguments" and some tools just add their own arguments for their own behavior. Think of it like
"handlebars --amd ${args} ${template}"
and the caller includes--no-amd
in the args. This is a simplified example.Here is the issue distilled down to the commands:
Version 4.7.5 (current):
Version 4.7.3:
Note that PR #1672 is a fix for this, liekly because it's just using the same parsing engine as all previous versions (minimist).
/cc @ErisDS
The text was updated successfully, but these errors were encountered: