(command: Command, concrete, args)
| 45 | * CLIExtension.run => commander.parse(params) => commander-pkg.parse => commander-pkg.parseArgs => execAction |
| 46 | */ |
| 47 | export async function execAction(command: Command, concrete, args): Promise<any> { |
| 48 | const flags = getOpts(concrete, command.options); |
| 49 | const relevantArgs = args.slice(0, args.length - 1); |
| 50 | Analytics.init(concrete.name(), flags, relevantArgs); |
| 51 | logger.info(`[*] started a new command: "${command.name}" with the following data:`, { |
| 52 | args: relevantArgs, |
| 53 | flags |
| 54 | }); |
| 55 | if (command.loader && !flags.json) { |
| 56 | loader.on(); |
| 57 | } |
| 58 | if (flags[TOKEN_FLAG_NAME]) { |
| 59 | globalFlags.token = flags[TOKEN_FLAG_NAME].toString(); |
| 60 | } |
| 61 | logger.shouldWriteToConsole = !flags.json; |
| 62 | const commandRunner = new CommandRunner(command, relevantArgs, flags); |
| 63 | return commandRunner.runCommand(); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * register the action of each one of the commands. |
no test coverage detected