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

feat: formalize existing callback argument to showHelp #1386

Merged
merged 2 commits into from Sep 6, 2019

Conversation

royra
Copy link
Contributor

@royra royra commented Jul 30, 2019

This PR adds doc and test for an existing feature: Supplying a print callback to usage.showHelp instead of a console function name.

We use the callback in our code to explicitly specify the stdout/stderr stream dependencies of yargs - tests can use it instead of mocking the console.

Thanks for making this great library!

@royra royra changed the title feat: formalize the existing callback argument to feat: formalize existing callback argument to showHelp Jul 30, 2019
docs/api.md Outdated
.showHelp(printCallback)
---------------------------

Print the usage data using the specified callback, which accepts a single argument - the string to print.
Copy link
Member

Choose a reason for hiding this comment

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

If I recall, can showHelp take no callback and it will result in help printing to stdout?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bcoe Right. Added doc section (and test) to explicitly describe that.

docs/api.md Outdated Show resolved Hide resolved
docs/api.md Show resolved Hide resolved
docs/api.md Show resolved Hide resolved
docs/api.md Outdated Show resolved Hide resolved
test/usage.js Outdated Show resolved Hide resolved
@bcoe bcoe merged commit d217764 into yargs:master Sep 6, 2019
@bcoe
Copy link
Member

bcoe commented Sep 6, 2019

@royra your changes are in npm i yargs@next.

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

3 participants