Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
GOutputTemplate string
)
Functions ¶
func Table ¶
func Table(o interface{})
Table prints a table-formatted rendering of o to the terminal. If the object is of iterable type (slice only), each item is printed in a table row, with a header containing one column per type field. Otherwise, each field of the object is printed in a key/value formatted table, and a header is printed if the item type implements an optional (Type() string) method.
func TemplateAnnotations ¶
func TemplateAnnotations(o interface{}) []string
TemplateAnnotations returns a list of annotations available for use with an output template.
func Text ¶
func Text(o interface{})
Text prints a template-based plain text rendering of o to the terminal. If the object is of iterable type (slice only), each item is printed on a new line. If none is provided by the user, the default template prints all fields separated by a tabulation character.
Types ¶
type Outputter ¶
type Outputter interface { ToTable() ToJSON() ToText() }
Outputter is an interface that must to be implemented by the commands output objects. In addition to the methods, types implementing this interface can also use struct tags to modify the output logic:
- output:"-" is similar to package encoding/json, i.e. that a field with this tag will not be displayed
- outputLabel:"..." overrides the string displayed as label, which by default is the field's CamelCase named split with spaces