Documentation
¶
Index ¶
- type Bot
- type Config
- type UI
- func (u *UI) FieldTable(tbl *terminal.Table, _ ...terminal.Option)
- func (u *UI) Input(_ *terminal.Input) (string, error)
- func (u *UI) Interactive() bool
- func (u *UI) NamedValues(nvs []terminal.NamedValue, _ ...terminal.Option)
- func (u *UI) Output(str string, _ ...interface{})
- func (u *UI) OutputWriters() (stdout io.Writer, stderr io.Writer, err error)
- func (u *UI) Status() terminal.Status
- func (u *UI) StepGroup() terminal.StepGroup
- func (u *UI) Table(tbl *terminal.Table, opts ...terminal.Option)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UI ¶
type UI struct {
L hclog.Logger
// contains filtered or unexported fields
}
func (*UI) FieldTable ¶
func (u *UI) FieldTable(tbl *terminal.Table, _ ...terminal.Option)
Table outputs the information formatted into a Table structure.
func (*UI) Input ¶
func (u *UI) Input(_ *terminal.Input) (string, error)
Input asks the user for input. This will immediately return an error if the UI doesn't support interaction. You can test for interaction ahead of time with Interactive().
func (*UI) Interactive ¶
func (u *UI) Interactive() bool
Interactive returns true if this prompt supports user interaction. If this is false, Input will always error.
func (*UI) NamedValues ¶
func (u *UI) NamedValues(nvs []terminal.NamedValue, _ ...terminal.Option)
Output data as a table of data. Each entry is a row which will be output with the columns lined up nicely.
func (*UI) Output ¶
func (u *UI) Output(str string, _ ...interface{})
Output outputs a message directly to the terminal. The remaining arguments should be interpolations for the format string. After the interpolations you may add Options.
func (*UI) OutputWriters ¶
func (u *UI) OutputWriters() (stdout io.Writer, stderr io.Writer, err error)
OutputWriters returns stdout and stderr writers. These are usually but not always TTYs. This is useful for subprocesses, network requests, etc. Note that writing to these is not thread-safe by default so you must take care that there is only ever one writer.
func (*UI) Status ¶
func (u *UI) Status() terminal.Status
Status returns a live-updating status that can be used for single-line status updates that typically have a spinner or some similar style. While a Status is live (Close isn't called), other methods on UI should NOT be called.
func (*UI) StepGroup ¶
func (u *UI) StepGroup() terminal.StepGroup
StepGroup returns a value that can be used to output individual (possibly parallel) steps that have their own message, status indicator, spinner, and body. No other output mechanism (Output, Input, Status, etc.) may be called until the StepGroup is complete.