* @private * @method maybeMakeCommand * @param commandName * @param commandArgs * @return {null|CurrentCommand}
(commandName, commandArgs)
| 82 | * @return {null|CurrentCommand} |
| 83 | */ |
| 84 | maybeMakeCommand(commandName, commandArgs) { |
| 85 | if (this._environment === undefined) { |
| 86 | throw new Error('Unable to make command without environment, you have to execute "run" method first.'); |
| 87 | } |
| 88 | let CurrentCommand = lookupCommand(this._environment.commands, commandName, commandArgs, { |
| 89 | project: this._environment.project, |
| 90 | ui: this.ui, |
| 91 | }); |
| 92 | |
| 93 | /* |
| 94 | * XXX Need to decide what to do here about showing errors. For |
| 95 | * a non-CLI project the cache is local and probably should. For |
| 96 | * a CLI project the cache is there, but not sure when we'll know |
| 97 | * about all the errors, because there may be multiple projects. |
| 98 | * if (this.packageInfoCache.hasErrors()) { |
| 99 | * this.packageInfoCache.showErrors(); |
| 100 | * } |
| 101 | */ |
| 102 | let command = new CurrentCommand({ |
| 103 | ui: this.ui, |
| 104 | commands: this._environment.commands, |
| 105 | tasks: this._environment.tasks, |
| 106 | project: this._environment.project, |
| 107 | settings: this._environment.settings, |
| 108 | testing: this.testing, |
| 109 | cli: this, |
| 110 | }); |
| 111 | |
| 112 | return command; |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * @private |
no outgoing calls
no test coverage detected