Skip to content

Commit

Permalink
Add tips about showing help instead of just missing arguments error (#…
Browse files Browse the repository at this point in the history
…1547)

* Add tips about showing help instead of just missing arguments error

* Add block types. Fix indentation.
  • Loading branch information
shadowspawn authored Jun 13, 2021
1 parent 9fad40f commit cf58455
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,39 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
<!-- markdownlint-disable MD024 -->
<!-- markdownlint-disable MD004 -->

## [Unreleased] (date goes here)

### Migration Tips

If you have a simple program without an action handler, you will now get an error if
there are missing command-arguments.

```js
program
.option('-d, --debug')
.arguments('<file>');
program.parse();
```

```sh
$ node trivial.js
error: missing required argument 'file'
```

If you want to show the help in this situation, you could check the arguments before parsing:

```js
if (process.argv.length === 2)
program.help();
program.parse();
```

Or, you might choose to show the help after any user error:

```js
program.showHelpAfterError();
```

## [8.0.0-2] (2021-06-06)

### Added
Expand Down

0 comments on commit cf58455

Please sign in to comment.