output

package
v1.1.2-rc2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NonTabularFormats = []OutputFormat{JSONFormat, YAMLFormat}

Functions

func Output

func Output[T any](cmd *cobra.Command, columns []TableColumn[T], options OutputOptions, items []T) error

func OutputNonTabular added in v1.1.0

func OutputNonTabular[T any](cmd *cobra.Command, options NonTabularOutputOptions, items []T) error

func OutputOne

func OutputOne[T any](cmd *cobra.Command, columns []TableColumn[T], options OutputOptions, item T) error

func OutputOneNonTabular added in v1.1.0

func OutputOneNonTabular[T any](cmd *cobra.Command, options NonTabularOutputOptions, item T) error

func ShortenTime added in v1.1.0

func ShortenTime(formattedTime string, maxLen int) string

Types

type NonTabularOutputOptions added in v1.1.0

type NonTabularOutputOptions struct {
	Format OutputFormat // The output format for the list of jobs
	Pretty bool         // Pretty print the output
}

type OutputFormat

type OutputFormat string
const (
	TableFormat OutputFormat = "table"
	CSVFormat   OutputFormat = "csv"
	JSONFormat  OutputFormat = "json"
	YAMLFormat  OutputFormat = "yaml"
)

type OutputOptions

type OutputOptions struct {
	Format     OutputFormat // The output format for the list of jobs
	Pretty     bool         // Pretty print the output
	HideHeader bool         // Hide the column headers
	NoStyle    bool         // Remove all styling from table output.
	Wide       bool         // Print full values in the table results
}

type TableColumn

type TableColumn[T any] struct {
	table.ColumnConfig
	Value func(T) string
}

Jump to

Keyboard shortcuts

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