Documentation ¶
Index ¶
- Variables
- func NA(s string) string
- func ParseOutputOptions(out string) (string, []string)
- func YesNo(b bool) string
- type FieldFn
- type Table
- func (o *Table) AddAllowedFields(obj any) (*Table, error)
- func (o *Table) AddFieldAlias(field, alias string) *Table
- func (o *Table) AddFieldFn(field string, fn FieldFn) *Table
- func (o *Table) Columns() (cols []string)
- func (o *Table) Flush() error
- func (o *Table) RemoveAllowedField(fields ...string) *Table
- func (o *Table) ValidateColumns(cols []string) error
- func (o *Table) Write(columns []string, obj any) error
- func (o *Table) WriteHeader(columns []string)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrOutputOptionRequired = errors.New("output option required")
Functions ¶
func ParseOutputOptions ¶
Types ¶
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table is a generic way to format object as a table.
func (*Table) AddAllowedFields ¶
AddAllowedFields reads all first level field names of the struct and allows them to be used.
func (*Table) AddFieldAlias ¶
AddFieldAlias overrides the field name to allow custom column headers.
func (*Table) AddFieldFn ¶
AddFieldFn adds a function which handles the output of the specified field.
func (*Table) RemoveAllowedField ¶
RemoveAllowedField removes fields from the allowed list.
func (*Table) ValidateColumns ¶
ValidateColumns returns an error if invalid columns are specified.
func (*Table) WriteHeader ¶
WriteHeader writes the table header.
Click to show internal directories.
Click to hide internal directories.