* Finalizes the task runner by doing special-case setup for `amp --help`, * parsing the invoked command, and printing an error message if an unknown task * was called.
()
| 267 | * was called. |
| 268 | */ |
| 269 | function finalizeRunner() { |
| 270 | program.addHelpCommand(false); // We already have `amp --help` and `amp <task> --help` |
| 271 | if (isHelpTask) { |
| 272 | program.helpOption('--help', 'Print this list of tasks'); |
| 273 | program.usage('<task> <flags>'); |
| 274 | } |
| 275 | program.on('command:*', (args) => { |
| 276 | log(red('ERROR:'), 'Unknown task', cyan(args.join(' '))); |
| 277 | log('⤷ Run', cyan('amp --help'), 'for a full list of tasks.'); |
| 278 | log('⤷ Run', cyan('amp <task> --help'), 'for help with a specific task.'); |
| 279 | process.exitCode = 1; |
| 280 | }); |
| 281 | program.parse(); |
| 282 | } |
| 283 | |
| 284 | module.exports = { |
| 285 | createTask, |