progressui

package
v0.0.0-...-2745715 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Display

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

func NewDisplay

func NewDisplay(out io.Writer, mode DisplayMode, opts ...DisplayOpt) (Display, error)

NewDisplay constructs a Display that outputs to the given io.Writer with the given DisplayMode.

This method will return an error when the DisplayMode is invalid or if TtyMode is used but the io.Writer does not refer to a tty. AutoMode will choose TtyMode or PlainMode depending on if the output is a tty or not.

For TtyMode to work, the io.Writer should also implement console.File.

func (Display) UpdateFrom

func (d Display) UpdateFrom(ctx context.Context, ch chan *client.SolveStatus) ([]client.VertexWarning, error)

type DisplayMode

type DisplayMode string
const (
	// DefaultMode is the default value for the DisplayMode.
	// This is effectively the same as AutoMode.
	DefaultMode DisplayMode = ""
	// AutoMode will choose TtyMode or PlainMode depending on if the output is
	// a tty.
	AutoMode DisplayMode = "auto"
	// QuietMode discards all output.
	QuietMode DisplayMode = "quiet"
	// TtyMode enforces the output is a tty and will otherwise cause an error if it isn't.
	TtyMode DisplayMode = "tty"
	// PlainMode is the human-readable plain text output. This mode is not meant to be read
	// by machines.
	PlainMode DisplayMode = "plain"
	// RawJSONMode is the raw JSON text output. It will marshal the various solve status events
	// to JSON to be read by an external program.
	RawJSONMode DisplayMode = "rawjson"
)

type DisplayOpt

type DisplayOpt func(b *displayOpts)

func WithDesc

func WithDesc(text string, console string) DisplayOpt

func WithPhase

func WithPhase(phase string) DisplayOpt

Jump to

Keyboard shortcuts

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