bot

package
v0.11.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2023 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot struct {
	// contains filtered or unexported fields
}

func NewBot

func NewBot(cfg Config) (*Bot, error)

func (*Bot) Run

func (b *Bot) Run(ctx context.Context, L hclog.Logger) error

type Config

type Config struct {
	Token string
}

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.

func (*UI) Table

func (u *UI) Table(tbl *terminal.Table, opts ...terminal.Option)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL