* run command using one of the handler, "json"/"report"/"render". once done, exit the process.
()
| 14 | * run command using one of the handler, "json"/"report"/"render". once done, exit the process. |
| 15 | */ |
| 16 | async runCommand() { |
| 17 | try { |
| 18 | await this.runMigrateIfNeeded(); |
| 19 | if (this.flags.json) { |
| 20 | return await this.runJsonHandler(); |
| 21 | } |
| 22 | if (this.shouldRunRender()) { |
| 23 | return await this.runRenderHandler(); |
| 24 | } |
| 25 | if (this.command.report) { |
| 26 | return await this.runReportHandler(); |
| 27 | } |
| 28 | } catch (err) { |
| 29 | return handleErrorAndExit(err, this.command.name, this.command.internal); |
| 30 | } |
| 31 | |
| 32 | throw new Error(`command "${this.command.name}" doesn't implement "render" nor "report" methods`); |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * when both "render" and "report" were implemented, check whether it's a terminal. |
no test coverage detected