Documentation ¶
Index ¶
- func Default(name string) (string, bool)
- func RemoveDefault(name string) error
- func RemoveSetting(name string) error
- func SetDefault(name string, value string) error
- func SetSetting(name string, value string) error
- func Setting(configname string) (string, bool)
- func Settings() map[string]string
- func StringCompletions(possibilities []string, toComplete string) ([]string, cobra.ShellCompDirective)
- func WrapError(exitcode int, err error) error
- func WrapErrorMessage(exitcode int, message string) error
- func WrapErrorMessagef(exitcode int, messageformat string, v ...interface{}) error
- type Command
- type Error
- type JSONRenderer
- type TableColumn
- type TableRenderer
- type TemplateRenderer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RemoveDefault ¶
RemoveDefault deletes a setting called default-<name>. If the setting does not exist, nothing happens.
func RemoveSetting ¶
RemoveSetting deletes the specified setting. If the setting does not exist, nothing happens.
func SetDefault ¶
SetDefault sets a setting called default-<name> to the specified value.
func SetSetting ¶
SetSetting sets the specified setting to the specified value.
func Setting ¶
Setting gets the value for the specified setting. If a value does not exist, an empty string is returned.
func StringCompletions ¶
func StringCompletions(possibilities []string, toComplete string) ([]string, cobra.ShellCompDirective)
StringCompletions filters a slice of strings to those members that start with the specified string.
func WrapErrorMessage ¶
WrapErrorMessage wraps a string into a cli Error.
func WrapErrorMessagef ¶
WrapErrorMessagef wraps a formatted string into a cli Error. Arguments are specified in the manner of fmt.Printf.
Types ¶
type Error ¶
Error represents an error that can happen during kutti CLI execution. It can wrap a Go error or a simple message. It also has an exit code which will be returned to the OS if it bubbles to the top.
func UnwrapError ¶
UnwrapError tries to typecast a Go error into a cli Error.
type JSONRenderer ¶
type JSONRenderer struct {
// contains filtered or unexported fields
}
JSONRenderer generates prettified JSON.
func NewJSONRenderer ¶
func NewJSONRenderer(indentspaces int) *JSONRenderer
NewJSONRenderer returns a new JSON Renderer, which will render prettified JSON indented by the specified number of spaces.
func (*JSONRenderer) Render ¶
func (j *JSONRenderer) Render(out io.Writer, arg interface{})
Render writes prettified JSON to the specified writer. It uses json.MarshalIndent for formatting.
type TableColumn ¶
type TableColumn struct { // Name should exactly match the name of an input field. Name string // Title can be left blank. The name will be used. Title string // DefaultCheck can be set to true to mark a row as default // based on the value of this column. DefaultCheck bool // Width specifies the column width in characters. Width int // FormatPrefix specifies any go template function that // should precede the value. FormatPrefix string }
TableColumn represents a column of tabular output.
type TableRenderer ¶
type TableRenderer struct {
// contains filtered or unexported fields
}
TableRenderer generates tabular output given a set of TableColumns. It generates and executes a template to print values for the columns.
func NewMapTableRenderer ¶
func NewMapTableRenderer( name string, columns []*TableColumn, ) *TableRenderer
NewMapTableRenderer returns a TableRenderer, and generates a template, for the special case of rendering a simple key/value map.
func NewTableRenderer ¶
func NewTableRenderer( name string, columns []*TableColumn, defaultvalue string, ) *TableRenderer
NewTableRenderer returns a new TableRenderer, and generates a template to produce tabular output.
func (*TableRenderer) Render ¶
func (f *TableRenderer) Render(out io.Writer, arg interface{})
Render writes table-formatted output to the specified writer. It uses the text/tabwriter package for formatting.
type TemplateRenderer ¶
type TemplateRenderer struct {
// contains filtered or unexported fields
}
TemplateRenderer renders a template.
func NewTemplateRenderer ¶
func NewTemplateRenderer(name string, templatesource string) (*TemplateRenderer, error)
NewTemplateRenderer returns a new TemplateRender, or an error.
func (*TemplateRenderer) Render ¶
func (t *TemplateRenderer) Render(out io.Writer, arg interface{})
Render executes this renderer's template on the specified writer.