* Check if the parsed options contain any unknown options * * Exit and output error when true
()
| 271 | * Exit and output error when true |
| 272 | */ |
| 273 | checkUnknownOptions(): void { |
| 274 | const { options, globalCommand } = this.cli |
| 275 | |
| 276 | if (!this.config.allowUnknownOptions) { |
| 277 | for (const name of Object.keys(options)) { |
| 278 | if ( |
| 279 | name !== '--' && |
| 280 | !this.hasOption(name) && |
| 281 | !globalCommand.hasOption(name) |
| 282 | ) { |
| 283 | throw new CACError( |
| 284 | `Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``, |
| 285 | ) |
| 286 | } |
| 287 | } |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | /** |
| 292 | * Check if the required string-type options exist |
no test coverage detected