Skip to content

feat: split demand() into demandCommand()/demandOption()#740

Merged
bcoe merged 16 commits into
masterfrom
fix-demand-api
Dec 29, 2016
Merged

feat: split demand() into demandCommand()/demandOption()#740
bcoe merged 16 commits into
masterfrom
fix-demand-api

Conversation

@bcoe

@bcoe bcoe commented Dec 26, 2016

Copy link
Copy Markdown
Member

Getting @lrlna's wonderful work on splitting demand() into demandCommand()/demandOption() over the finish line.

Everything is %99 of the way there, just addressing some final nits from @maxrimue and myself -- excited to try to get yargs down to a few less open issue.

TODO:

fixes #504, #431 follow up with #618

@bcoe

bcoe commented Dec 27, 2016

Copy link
Copy Markdown
Member Author

@ljharb sorry this turned into a never ending yak shave! The demand() API was pretty all over the place, and it took quite a bit of refactoring to get things to where we wanted them.

Any ways, months overdue but I think this gets things to what you pushed us towards. Thanks @lrlna for the hard work 🎉

@ljharb

ljharb commented Dec 27, 2016

Copy link
Copy Markdown
Contributor

Thanks to everybody :-) I look forward to consuming it once it's released.

@bcoe bcoe requested review from lrlna, maxrimue and nexdrew and removed request for nexdrew December 27, 2016 07:11

@lrlna lrlna left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for finishing this off @bcoe ✨ ; it looks really good!!

@bcoe bcoe merged commit 66573c8 into master Dec 29, 2016
@bcoe bcoe deleted the fix-demand-api branch December 29, 2016 06:23
@bcoe

bcoe commented Dec 29, 2016

Copy link
Copy Markdown
Member Author

@ljharb @maxrimue @lrlna this is queued up to go out with the next latest release of yargs. I would love your help testing since 6.6.0 is a big one:

npm cache clear; npm i yargs@next

@lrlna

lrlna commented Dec 29, 2016

Copy link
Copy Markdown
Member

@bcoe are you doing this one as a major though? Or with 6.6.0 ?

@bcoe

bcoe commented Dec 29, 2016

Copy link
Copy Markdown
Member Author

@lrlna since we opted to keep the demand() method for the time being, I see no reason to bump a major; however, I'm starting to picture what a 7.x release would look like. I would love to solve these problems specifically:

CC: @nexdrew, @maxrimue

@maxrimue

Copy link
Copy Markdown
Member

@bcoe I think that sounds like a good plan. What do you think when should we take action about the readme refactoring?

@bcoe

bcoe commented Dec 29, 2016

Copy link
Copy Markdown
Member Author

@maxrimue I approve of this message; I've noticed a lot of big JS projects have moved towards smaller READMEs with external doc sites.

@bcoe

bcoe commented Dec 29, 2016

Copy link
Copy Markdown
Member Author

@maxrimue want to start pulling together a v7 thread? I loved how you helped with release management last time.

@maxrimue

Copy link
Copy Markdown
Member

@bcoe on it

@kumar303

kumar303 commented Jan 4, 2017

Copy link
Copy Markdown

As of 6.6.0, demand() did slightly regress. The custom message is no longer displayed. That's ok though -- our tests failed, we read the readme, learned about the deprecation, and switched to the new methods :) Thanks for keeping a concise changelog.

@bcoe

bcoe commented Jan 4, 2017

Copy link
Copy Markdown
Member Author

@kumar303 mind sharing the syntax that had a regression for you, I'd like to patch this in the 6.x stream.

@kumar303

kumar303 commented Jan 4, 2017

Copy link
Copy Markdown

Sure, here is a script to reproduce it:

var yargs = require('yargs');
yargs
  .help('help')
  .demand(0, 0, 'This is a custom message to explain the error better')
  .strict()
  .argv;

In [email protected]:

$ node script.js nope
Options:
  --help  Show help                                                    [boolean]

Too many non-option arguments: got 1, maximum of 0

In [email protected]:

$ node script.js nope
Options:
  --help  Show help                                                    [boolean]

This is a custom message to explain the error better

@bcoe

bcoe commented Jan 5, 2017

Copy link
Copy Markdown
Member Author

@kumar303 thank you; I'll get a regression test written this evening.

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.

separate demand into demandOption and demandCommand

5 participants