-
-
Notifications
You must be signed in to change notification settings - Fork 151
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
allowUnknownFlags option and camel case #178
Comments
// @weareoutman |
I'll look at this later. And I also noticed there is a problem when passing |
@ozum There is currently a workaround to fix this, set an alias for const flags = { outDir: { type: "string", alias: "o" } }; Or set the alias to The related issue is yargs/yargs-parser#359. I suggest to wait for responses of this issue from yargs-parser, before doing fixes in meow. |
@weareoutman thanks for the effort and for providing a workaround. It helps a lot. Only a camel-case key with a kebab-key alias works for me. const flags = { outDir: { type: "string", alias: "out-dir" } }; |
Camel-case flags was not working as expected. See: sindresorhus/meow#178
Multiple aliases will be supported in the next release, so there will be a workaround with less tradeoffs: const flags = { outDir: { type: "string", aliases: ["out-dir"], shortFlag: "o" } }; |
Hi,
Thanks for the library and the great effort.
I need help with an issue:
When I set
allowUnknownFlags
tofalse
, camel-case flags are reported asunknown flag
. However, when I setallowUnknownFlags
totrue
, both camel-cased and dash-cased flags populate the same camel case key (e.g.out-dir
andoutDir
result with{ flags: outDir: "xxx" }
).I expected when
allowUnknownFlags
istrue
, both types of flags are allowed, because dash cased flags are already converted to camel case in the result object.Please see examples below:
allowUnknownFlags: false
with camel-case flagCommand:
$ cmd --outDir models
Result:
Unknown flag --outDir
Expected:
{ outDir: "models" }
allowUnknownFlags: true
Command:
$ cmd --outDir models
Result:
{ outDir: "models" }
Command:
$ cmd --out-dir models
Result:
{ outDir: "models" }
Kind Regards,
The text was updated successfully, but these errors were encountered: