(tableGenerator: TableGenerator, fieldDefinitions: TableFieldDefinition<T>[], includeIndex = false)
| 59 | (item: T) => tableGenerator.buildTableFromItem(item, fieldDefinitions) |
| 60 | |
| 61 | export const listTableFormatter = <T extends object>(tableGenerator: TableGenerator, fieldDefinitions: TableFieldDefinition<T>[], includeIndex = false): OutputFormatter<T[]> => { |
| 62 | let count = 0 |
| 63 | const tfd = includeIndex ? [{ |
| 64 | label: '#', |
| 65 | value: () => (++count).toString(), |
| 66 | }, ...fieldDefinitions] : fieldDefinitions |
| 67 | return (data: T[]) => { |
| 68 | count = 0 |
| 69 | return tableGenerator.buildTableFromList(data, tfd) |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | export const writeOutput = async (dataStr: string, filename?: string): Promise<void> => { |
| 74 | if (filename) { |
no outgoing calls
no test coverage detected