* Output help information and exit. * * Outputs built-in help, and custom text added using `.addHelpText()`. * * @param {{ error: boolean }} [contextOptions] - pass {error:true} to write to stderr instead of stdout
(contextOptions)
| 2633 | */ |
| 2634 | |
| 2635 | help(contextOptions) { |
| 2636 | this.outputHelp(contextOptions); |
| 2637 | let exitCode = Number(process.exitCode ?? 0); // process.exitCode does allow a string or an integer, but we prefer just a number |
| 2638 | if ( |
| 2639 | exitCode === 0 && |
| 2640 | contextOptions && |
| 2641 | typeof contextOptions !== 'function' && |
| 2642 | contextOptions.error |
| 2643 | ) { |
| 2644 | exitCode = 1; |
| 2645 | } |
| 2646 | // message: do not have all displayed text available so only passing placeholder. |
| 2647 | this._exit(exitCode, 'commander.help', '(outputHelp)'); |
| 2648 | } |
| 2649 | |
| 2650 | /** |
| 2651 | * // Do a little typing to coordinate emit and listener for the help text events. |
no test coverage detected