MCPcopy Create free account
hub / github.com/langgenius/dify / stringifyTableOutput

Function stringifyTableOutput

cli/src/framework/output.ts:102–116  ·  view source on GitHub ↗
(output: TableOutput<TablePrintable>)

Source from the content-addressed store, hash-verified

100}
101
102function 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
118function renderTable(output: TableOutput<TablePrintable>): string {
119 const wide = output.format === 'wide'

Callers 1

stringifyOutputFunction · 0.85

Calls 4

toNameFunction · 0.85
renderTableFunction · 0.70
jsonMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected