Compare commits
1 Commits
723aae48ce
...
fix/table-
| Author | SHA1 | Date | |
|---|---|---|---|
| 7fc3bc7890 |
@ -41,7 +41,6 @@ func (f *TableFormatter) Format(list *interfaces.ResourceList) (io.Reader, error
|
|||||||
|
|
||||||
// Setup table
|
// Setup table
|
||||||
t := table.NewWriter()
|
t := table.NewWriter()
|
||||||
t.SetOutputMirror(outputBuffer)
|
|
||||||
t.SetStyle(table.StyleLight)
|
t.SetStyle(table.StyleLight)
|
||||||
|
|
||||||
// Write header
|
// Write header
|
||||||
@ -66,15 +65,22 @@ func (f *TableFormatter) Format(list *interfaces.ResourceList) (io.Reader, error
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
switch f.RenderFormat {
|
output := func() string {
|
||||||
case tableFormatCSV:
|
switch f.RenderFormat {
|
||||||
t.RenderCSV()
|
case tableFormatCSV:
|
||||||
case tableFormatHTML:
|
return t.RenderCSV()
|
||||||
t.RenderHTML()
|
case tableFormatHTML:
|
||||||
case tableFormatMarkdown:
|
return t.RenderHTML()
|
||||||
t.RenderMarkdown()
|
case tableFormatMarkdown:
|
||||||
default:
|
return t.RenderMarkdown()
|
||||||
t.Render()
|
default:
|
||||||
|
return t.Render()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
_, err := outputBuffer.WriteString(output)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to write rendered table: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return outputBuffer, nil
|
return outputBuffer, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user