Skip to content

Commit

Permalink
Make --help/--version work w/ !allowUnknownFlags
Browse files Browse the repository at this point in the history
Make `--help` and `--version` work with `allowUnknownFlags: false`

Fixes: sindresorhusGH-197
  • Loading branch information
msabramo committed Sep 15, 2021
1 parent 075f96f commit f80cb52
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ const meow = (helpText, options = {}) => {
...options,
};

if (options.autoHelp) {
options.flags.help = {type: 'boolean'}
}
if (options.autoVersion) {
options.flags.version = {type: 'boolean'}
}

if (options.hardRejection) {
hardRejection();
}
Expand Down

0 comments on commit f80cb52

Please sign in to comment.