Help us shape the future of Go! Take the 2026 Go Developer Survey

format

package
v0.3.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2026 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OutputFormat

type OutputFormat string
const (
	// format
	OutputFormatTable  OutputFormat = "table"
	OutputFormatTSV    OutputFormat = "tsv"
	OutputFormatCSV    OutputFormat = "csv"
	OutputFormatJSON   OutputFormat = "json"
	OutputFormatLegacy OutputFormat = "legacy"
)

func GetOutputFormat

func GetOutputFormat(order string) OutputFormat

GetOutputFormat returns OutputFormat from string

type OutputFormatter

type OutputFormatter struct {
	Writer io.Writer
	Tables []OutputFormatterTable
}

func NewOutputFormatter

func NewOutputFormatter(writer io.Writer) *OutputFormatter

func (*OutputFormatter) GetCurrentTable

func (of *OutputFormatter) GetCurrentTable() *OutputFormatterTable

func (*OutputFormatter) GetJSON

func (of *OutputFormatter) GetJSON(pretty bool) string

func (*OutputFormatter) NewTable

func (of *OutputFormatter) NewTable(title string) *OutputFormatterTable

func (*OutputFormatter) Render

func (of *OutputFormatter) Render(format OutputFormat)

func (*OutputFormatter) RenderJSON

func (of *OutputFormatter) RenderJSON()

type OutputFormatterTable

type OutputFormatterTable struct {
	Title    string
	Header   []string
	WidthMax []int
	Rows     [][]interface{}
}

func (*OutputFormatterTable) AppendRow

func (oft *OutputFormatterTable) AppendRow(row []interface{})

func (*OutputFormatterTable) AppendRows

func (oft *OutputFormatterTable) AppendRows(rows [][]interface{})

func (*OutputFormatterTable) SetColumnWidthMax

func (oft *OutputFormatterTable) SetColumnWidthMax(widthMax []int)

func (*OutputFormatterTable) SetHeader

func (oft *OutputFormatterTable) SetHeader(header []string)

func (*OutputFormatterTable) ToObject

type OutputFormatterTableObject

type OutputFormatterTableObject struct {
	Title string                   `json:"title"`
	Data  []map[string]interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL