Documentation ¶
Overview ¶
Licensed under the MIT License https://opensource.org/licenses/MIT
Index ¶
- func AddFlag(cmd *cobra.Command, options ...Option)
- func GetFlag(cmd *cobra.Command) []string
- type FieldFn
- type Option
- type Opts
- type Table
- func (o *Table) AddAllowedFields(obj interface{}) *Table
- 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 interface{})
- func (o *Table) WriteHeader(columns []string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
func OptionColumns ¶
func OptionFormat ¶
func OptionFormat() Option
func OptionJSON ¶
func OptionJSON() Option
func OptionNoHeader ¶
func OptionNoHeader() Option
func OptionYAML ¶
func OptionYAML() Option
type Opts ¶
func FlagsForCommand ¶
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 fieldnames 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.