MCPcopy
hub / github.com/ampproject/amphtml / finalizeRunner

Function finalizeRunner

build-system/task-runner/amp-task-runner.js:269–282  ·  view source on GitHub ↗

* 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.

()

Source from the content-addressed store, hash-verified

267 * was called.
268 */
269function 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
284module.exports = {
285 createTask,

Callers 1

amp.jsFile · 0.85

Calls 5

redFunction · 0.85
cyanFunction · 0.85
logFunction · 0.50
onMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected