Documentation
¶
Index ¶
- Constants
- func NewLineWriter(writeln func(line string)) io.WriteCloser
- func ReplayFromJSON(r io.Reader, in *Interface, result interface{})
- type Handler
- type Interface
- func (in *Interface) Close() error
- func (in *Interface) Debug(format string, v ...interface{})
- func (in *Interface) Do(format string, v ...interface{}) error
- func (in *Interface) Error(format string, v ...interface{})
- func (in *Interface) Info(format string, v ...interface{})
- func (in *Interface) NewStream(label string, level Level, err bool) *Stream
- func (in *Interface) Object(level Level, o interface{})
- func (in *Interface) Prompt(format string, v ...interface{}) bool
- func (in *Interface) Result(o interface{})
- func (in *Interface) Start(format string, v ...interface{}) Operation
- func (in *Interface) Verbose(format string, v ...interface{})
- func (in *Interface) Warning(format string, v ...interface{})
- type Level
- type MultiWriter
- type Operation
- type StdObjectFormat
- type StdOptions
- type Stream
Constants ¶
const ( LevelQuiet = Level(-1) LevelNormal = Level(0) LevelVerbose = Level(1) LevelDebug = Level(2) )
Output levels
const ( StdObjectFormatYAML = StdObjectFormat(0) StdObjectFormatJSON = StdObjectFormat(1) )
Standard output interface object formats
Variables ¶
This section is empty.
Functions ¶
func NewLineWriter ¶
func NewLineWriter(writeln func(line string)) io.WriteCloser
NewLineWriter creates a new line-segmented writer
func ReplayFromJSON ¶
ReplayFromJSON reads the output from a JSON output interface and replays it on another output interface, optionally capturing the result in an output object
Types ¶
type Handler ¶
type Handler interface {
Message(level Level, format string, v ...interface{})
Warning(format string, v ...interface{})
Error(format string, v ...interface{})
Prompt(format string, v ...interface{}) bool
Start(format string, v ...interface{}) Operation
NewWriter(label string, level Level, err bool) io.WriteCloser
Object(level Level, o interface{})
Result(o interface{})
io.Closer
}
Handler represents an output interface handler
type Interface ¶
type Interface struct {
Level
// contains filtered or unexported fields
}
Interface represents an output interface
func NewInterface ¶
NewInterface creates a new output interface
func NewJSONInterface ¶
NewJSONInterface creates a new output interface that marshals JSON objects as lines to a writer
func NewLogger ¶
NewLogger creates a new standard output interface that prefixes a timestamp to each line of output
func NewStdInterface ¶
NewStdInterface creates a new output interface that formats output to standard output and error writers
func (*Interface) Prompt ¶
Prompt asks an interactive user to answer a question, or for non-interactive sessions, returns a pre-configured response
func (*Interface) Result ¶
func (in *Interface) Result(o interface{})
Result returns a result object
type MultiWriter ¶
MultiWriter represents a writer that duplicates its writes to a set of writers that can be dynamically attached and detached
func NewMultiWriter ¶
func NewMultiWriter(w ...io.Writer) MultiWriter
NewMultiWriter creates a new multi writer with an initial set of attached writers
type Operation ¶
type Operation interface {
Progress(format string, v ...interface{})
Aborted()
Failed()
Done()
}
Operation represents an output operation
type StdObjectFormat ¶
type StdObjectFormat int
StdObjectFormat represents a standard output interface object format
type StdOptions ¶
type StdOptions struct {
AcceptPrompts bool
ObjectFormat StdObjectFormat
}
StdOptions represents standard output interface options