()
| 45 | } |
| 46 | |
| 47 | private async runJsonHandler() { |
| 48 | if (!this.flags.json) return null; |
| 49 | if (!this.command.json) throw new Error(`command "${this.command.name}" doesn't implement "json" method`); |
| 50 | const result = await this.command.json(this.args, this.flags); |
| 51 | loader.off(); |
| 52 | const code = result.code || 0; |
| 53 | const data = result.data || result; |
| 54 | return this.writeAndExit(JSON.stringify(data, null, 2), code); |
| 55 | } |
| 56 | |
| 57 | private async runRenderHandler() { |
| 58 | if (!this.command.render) throw new Error('runRenderHandler expects command.render to be implemented'); |
no test coverage detected