labcli

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapStatusError

func WrapStatusError(err error) error

Types

type CLI

type CLI interface {
	Streams

	SetQuiet(bool)

	// Regular print to stdout.
	PrintOut(string, ...any)

	// Regular print to stderr.
	PrintErr(string, ...any)

	// Print to stderr unless quiet else - discard.
	PrintAux(string, ...any)

	SetConfig(*config.Config)

	Config() *config.Config

	SetClient(*api.Client)

	Client() *api.Client

	Confirm(title, affirmative, negative string) bool

	Input(title, prompt string, value *string, validate func(string) error) error

	Version() string
}

func NewCLI

func NewCLI(cin io.ReadCloser, cout io.Writer, cerr io.Writer, version string) CLI

type StatusError

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

func NewStatusError

func NewStatusError(code int, format string, a ...any) StatusError

func (StatusError) Code

func (e StatusError) Code() int

func (StatusError) Error

func (e StatusError) Error() string

type Streams

type Streams interface {
	InputStream() *streams.In
	OutputStream() *streams.Out
	AuxStream() *streams.Out // ErrorStream unless quiet else io.Discard
	ErrorStream() io.Writer
}

Jump to

Keyboard shortcuts

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