format

package
v0.11.13 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 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 ListFormat

type ListFormat string
const (
	// format
	ListFormatNormal   ListFormat = ""
	ListFormatLong     ListFormat = "long"
	ListFormatVeryLong ListFormat = "verylong"
)

type ListSortOrder

type ListSortOrder string
const (
	// sort
	ListSortOrderNone ListSortOrder = ""
	ListSortOrderName ListSortOrder = "name"
	ListSortOrderSize ListSortOrder = "size"
	ListSortOrderTime ListSortOrder = "time"
	ListSortOrderExt  ListSortOrder = "ext"
)

func GetListSortOrder

func GetListSortOrder(order string) ListSortOrder

GetListSortOrder returns ListSortOrder from string

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 added in v0.11.2

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

func NewOutputFormatter added in v0.11.2

func NewOutputFormatter(writer io.Writer) *OutputFormatter

func (*OutputFormatter) GetCurrentTable added in v0.11.2

func (of *OutputFormatter) GetCurrentTable() *OutputFormatterTable

func (*OutputFormatter) GetJSON added in v0.11.2

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

func (*OutputFormatter) NewTable added in v0.11.2

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

func (*OutputFormatter) Render added in v0.11.2

func (of *OutputFormatter) Render(format OutputFormat)

func (*OutputFormatter) RenderJSON added in v0.11.2

func (of *OutputFormatter) RenderJSON()

type OutputFormatterTable added in v0.11.2

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

func (*OutputFormatterTable) AppendRow added in v0.11.2

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

func (*OutputFormatterTable) AppendRows added in v0.11.2

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

func (*OutputFormatterTable) SetColumnWidthMax added in v0.11.3

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

func (*OutputFormatterTable) SetHeader added in v0.11.2

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

func (*OutputFormatterTable) ToObject added in v0.11.2

type OutputFormatterTableObject added in v0.11.2

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