Skip to content

Commit

Permalink
Add mention of makeOptionMandatory in README (#1797)
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowspawn committed Sep 8, 2022
1 parent 72be61c commit 8236966
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Readme.md
Expand Up @@ -330,7 +330,7 @@ For information about possible ambiguous cases, see [options taking varying argu

### Required option

You may specify a required (mandatory) option using `.requiredOption`. The option must have a value after parsing, usually specified on the command line, or perhaps from a default value (say from environment). The method is otherwise the same as `.option` in format, taking flags and description, and optional default value or custom processing.
You may specify a required (mandatory) option using `.requiredOption()`. The option must have a value after parsing, usually specified on the command line, or perhaps from a default value (say from environment). The method is otherwise the same as `.option()` in format, taking flags and description, and optional default value or custom processing.

Example file: [options-required.js](./examples/options-required.js)

Expand Down Expand Up @@ -441,6 +441,8 @@ $ extra --disable-server --port 8000
error: option '--disable-server' cannot be used with option '-p, --port <number>'
```

Specify a required (mandatory) option using the `Option` method `.makeOptionMandatory()`. This matches the `Command` method [.requiredOption()](#required-option).

### Custom option processing

You may specify a function to do custom processing of option-arguments. The callback function receives two parameters,
Expand Down

0 comments on commit 8236966

Please sign in to comment.