sindresorhus / meow

🐈 CLI app helper
MIT License
3.53k stars 150 forks source link

isRequired does not recognize kebab-case flags #166

Closed alexmcmanus closed 3 years ago

alexmcmanus commented 3 years ago

Fix for #165 - the isRequired option is broken if the flag is defined in camel-case.

sbencoding commented 3 years ago

Hi! I don't know if I should post this here or on the issue, but a shorter solution, that doesn't require an additional dependency would be to pass argv instead of flags when getMissingRequiredFlags is called, because argv has the kebab-case flags as well as the camelCase variations, but only the camelCase variation is available in flags.

alexmcmanus commented 3 years ago

Thanks for your feedback. The new dependency is an existing transitive dependency made explicit, but I agree your solution is simpler. I'm happy to make the change, but I'm not too sure this general approach is acceptable to the project maintainer, as it seems flags are supposed to be defined in camelCase. I'll post another comment and see if we can agree an approach. Thanks again.

sindresorhus commented 3 years ago

Closing in favor of https://github.com/sindresorhus/meow/issues/165#issuecomment-712394008