(output: TableOutput<TablePrintable>)
| 100 | } |
| 101 | |
| 102 | function stringifyTableOutput(output: TableOutput<TablePrintable>): string { |
| 103 | switch (output.format) { |
| 104 | case '': |
| 105 | case OutputFormat.WIDE: |
| 106 | return renderTable(output) |
| 107 | case OutputFormat.JSON: |
| 108 | return `${JSON.stringify(output.data.json(), null, 2)}\n` |
| 109 | case OutputFormat.YAML: |
| 110 | return yaml.dump(output.data.json(), { indent: 2, lineWidth: -1 }) |
| 111 | case OutputFormat.NAME: |
| 112 | return `${toName(output.data)}\n` |
| 113 | default: |
| 114 | throw new OutputFormatNotSupportedError(output.format) |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | function renderTable(output: TableOutput<TablePrintable>): string { |
| 119 | const wide = output.format === 'wide' |
no test coverage detected