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

make opts object not required anymore for .option() #624

Merged
merged 1 commit into from Sep 26, 2016

Conversation

maxrimue
Copy link
Member

Usually, yargs always requires options to be featuring an object for customisation like so:

yargs()
  .option('x', {})
  .argv

This however seemed strange to me, as said customisation never is needed, you can also use options without any further customisation.

This Pull Request removes the check for whether an object is given to allow for declaration of options like this:

yargs()
  .option('x')
  .argv

Why would we do that? Because it the object isn't needed anyway, requiring it makes little sense, and it might be confusing to people. Also, some people (like me) might prefer to write down all options in the yargs configuration to make clear which ones exist, also making yargs list them in the argv object even if not passed.

@bcoe
Copy link
Member

bcoe commented Sep 25, 2016

@maxrimue love it! sorry I've been slightly AWOL. ETOOMUCHOSS

@bcoe bcoe merged commit 4f29de6 into master Sep 26, 2016
@bcoe bcoe deleted the dont-require-opts-for-options branch September 26, 2016 05:33
@bcoe
Copy link
Member

bcoe commented Sep 30, 2016

@maxrimue want to give this a spin?

npm cache clear; yargs@6.0.0-alpha.1

This feature goes out with the next release 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants