Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidFormatType = fmt.Errorf("invalid format type")
ErrInvalidFormatType is returned when an unsupported format type is used
Functions ¶
func EncodeJSON ¶
EncodeJSON is a helper function to decorate any error message with a bit more context and avoid writing the same code over and over for printers.
func EncodeTable ¶
EncodeTable is a helper function to decorate any error message with a bit more context and avoid writing the same code over and over for printers
func EncodeYAML ¶
EncodeYAML is a helper function to decorate any error message with a bit more context and avoid writing the same code over and over for printers
func Formats ¶
func Formats() []string
Formats returns a list of the string representation of the supported formats
func FormatsWithDesc ¶
FormatsWithDesc returns a list of the string representation of the supported formats including a description
Types ¶
type Format ¶
type Format string
Format is a type for capturing supported output formats
func ParseFormat ¶
ParseFormat takes a raw string and returns the matching Format. If the format does not exists, ErrInvalidFormatType is returned
type Writer ¶
type Writer interface { // WriteTable will write tabular output into the given io.Writer, returning // an error if any occur WriteTable(out io.Writer) error // WriteJSON will write JSON formatted output into the given io.Writer, // returning an error if any occur WriteJSON(out io.Writer) error // WriteYAML will write YAML formatted output into the given io.Writer, // returning an error if any occur WriteYAML(out io.Writer) error }
Writer is an interface that any type can implement to write supported formats