MCPcopy
hub / github.com/cacjs/cac / runMatchedCommand

Method runMatchedCommand

src/cac.ts:341–364  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

339 }
340
341 runMatchedCommand(): any {
342 const { args, options, matchedCommand: command } = this
343
344 if (!command || !command.commandAction) return
345
346 command.checkUnknownOptions()
347
348 command.checkOptionValue()
349
350 command.checkRequiredArgs()
351
352 command.checkUnusedArgs()
353
354 const actionArgs: any[] = []
355 command.args.forEach((arg, index) => {
356 if (arg.variadic) {
357 actionArgs.push(args.slice(index))
358 } else {
359 actionArgs.push(args[index])
360 }
361 })
362 actionArgs.push(options)
363 return command.commandAction.apply(this, actionArgs)
364 }
365}

Callers 1

parseMethod · 0.95

Calls 4

checkUnknownOptionsMethod · 0.80
checkOptionValueMethod · 0.80
checkRequiredArgsMethod · 0.80
checkUnusedArgsMethod · 0.80

Tested by

no test coverage detected