Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var HostList *hostlist.HostInfoList
Functions ¶
func SetHostInfoList ¶
func SetHostInfoList(list *hostlist.HostInfoList)
SetHostInfoList sets global hostlist
Types ¶
type AnsiFormatter ¶
type AnsiFormatter struct {
// contains filtered or unexported fields
}
AnsiFormatter prints colored Outputs to stdout
func NewAnsiFormatter ¶
func NewAnsiFormatter() *AnsiFormatter
NewAnsiFormatter sets default colors.
func (*AnsiFormatter) Add ¶
func (af *AnsiFormatter) Add(output Output)
Add will print output to screen as AnsiFormatter is a real-time Formatter.
type Formatter ¶
type Formatter interface { Add(Output) Print() }
Formatter formats Output for each host. Executor will send Output to Formatter with Add, and make Formatter Print when finished.
type Info ¶
Info is the shared infomation for all Formatters Formatters may want to change print style by Info
type JSONFormatter ¶
type JSONFormatter struct {
// contains filtered or unexported fields
}
JSONFormatter prints Outputs in JSON format.
func NewJSONFormatter ¶
func NewJSONFormatter() *JSONFormatter
NewJSONFormatter is JSONFormatter's constructor
func (*JSONFormatter) Add ¶
func (jf *JSONFormatter) Add(output Output)
Add just collects all outputs, no prints.
func (*JSONFormatter) Print ¶
func (jf *JSONFormatter) Print()
Print prints all outputs that collected by Add
type Output ¶
type Output struct { Index int `json:"index"` Stdout string `json:"stdout"` Stderr string `json:"stderr"` Error string `json:"error"` // Hostname is the real host. Executor use this to connect. Hostname string `json:"hostname"` // Alias is the hostname that shown to user Alias string `json:"alias"` ExitCode int `json:"exitcode"` }
Output holds executor's output. And Formatter uses it for show.
type WindowFormatter ¶
type WindowFormatter struct {
// contains filtered or unexported fields
}
WindowFormatter shows Outputs with termui
func NewWindowFormatter ¶
func NewWindowFormatter() *WindowFormatter
NewWindowFormatter initializes a WindowFormatter, and starts it.
func (*WindowFormatter) Add ¶
func (wf *WindowFormatter) Add(output Output)
Add binds Output to machine, and refreshes contents on screen