Skip to content
Myr

Add tips about showing help instead of just missing arguments error (#1547)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* Add tips about showing help instead of just missing arguments error * Add block types. Fix indentation.

authored by John Gee · committed by GitHub · parent 9fad40f · Browse files · 1 file+33 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+33 added−0 removed

  • other:+33 added−0 removed

1 file+33 added−0 removed

modified:CHANGELOG.md+33 added
6 unmodified lines
78<!-- markdownlint-disable MD024 -->9<!-- markdownlint-disable MD004 -->1011## [Unreleased] (date goes here)1213### Migration Tips1415If you have a simple program without an action handler, you will now get an error if16there are missing command-arguments.1718```js19program20 .option('-d, --debug')21 .arguments('<file>');22program.parse();23```2425```sh26$ node trivial.js 27error: missing required argument 'file'28```2930If you want to show the help in this situation, you could check the arguments before parsing:3132```js33if (process.argv.length === 2)34 program.help();35program.parse();36```3738Or, you might choose to show the help after any user error:3940```js41program.showHelpAfterError();42```4344## [8.0.0-2] (2021-06-06)4546### Added47
347 unmodified lines