Documentation ¶
Index ¶
- Variables
- func AddFormatter(t reflect.Type, f Formatter)
- func MarshalJSON(v interface{}) string
- type App
- type Column
- type CustomFormatter
- type FormatOptions
- type FormatType
- type Formatter
- type HandlerFn
- type Logger
- type Options
- func (o *Options) Client() *kbclient.KillBill
- func (o *Options) DevClient() *debug.Client
- func (o *Options) Format(v interface{}, f Formatter) []string
- func (o *Options) Output(format string, args ...interface{})
- func (o *Options) OutputWithFormatter(v interface{}, f Formatter)
- func (o *Options) Outputln(format string, args ...interface{})
- func (o *Options) Print(v interface{})
- type Output
- type OutputRow
- type SubItem
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorInvalidArgs = fmt.Errorf("invalid args. try -h for syntax")
ErrorInvalidArgs - error returned when args are invalid
Functions ¶
func AddFormatter ¶
AddFormatter adds format function to the registry
func MarshalJSON ¶
func MarshalJSON(v interface{}) string
MarshalJSON serializes given type to json.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App provides interface for rest
type Column ¶
type Column struct { // Name of the column Name string // JsonPath to get the column Path string // Getter - Custom getter function Getter func(interface{}) interface{} }
Column represents column of a resource.
type CustomFormatter ¶
type CustomFormatter func(v interface{}, fo FormatOptions) Output
CustomFormatter function
type FormatOptions ¶
type FormatOptions struct { Type FormatType // NoHeader - skip printing header for tabular, csv format NoHeader bool }
FormatOptions - options for formatting
type FormatType ¶
type FormatType int
FormatType represents type of format
const ( // FormatTypeDefault - Default format. Uses tabular for single items, and short for collections. FormatTypeDefault FormatType = iota // FormatTypeTabular - tabular FormatTypeTabular FormatType = iota // FormatTypeShort - Tabular but sub items are not printed FormatTypeShort FormatType = iota // FormatTypeList - List of key value pairs (same items as table) FormatTypeList FormatType = iota // FormatTypeFullJSON - Full JSON FormatTypeFullJSON )
type Formatter ¶
type Formatter struct { // List of columns Columns []Column // CustomFn - custom format fn. Used if specified. CustomFn CustomFormatter // SubItems of the resource SubItems []SubItem }
Formatter represents settings for formatting a type.
type Logger ¶
type Logger interface { // Infof - print info. Infof(format string, args ...interface{}) // Warningf - print warning. Warningf(format string, args ...interface{}) // Errorf - print error. Errorf(format string, args ...interface{}) }
Logger - Logging interface.
type Options ¶
type Options struct { Host string Username string Password string CreatedBy string APIKey string APISecret string PrintDebug bool Args []string Log Logger FO *FormatOptions // contains filtered or unexported fields }
Options for command line
func (*Options) OutputWithFormatter ¶
OutputWithFormatter - print with custom formatter
type Output ¶
type Output struct { // Title of the output if any. Title string // Column names of this output Columns []string // Rows of this output Rows []OutputRow }
Output for a command
Source Files ¶
Click to show internal directories.
Click to hide internal directories.