labcli

package
v0.1.112 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 ExitError added in v0.1.41

type ExitError interface {
	ExitStatus() int
}

type Outputer added in v0.1.56

type Outputer interface {
	PrintOut(string, ...any)
	PrintErr(string, ...any)
	PrintAux(string, ...any)
}

type Printer added in v0.1.47

type Printer[T any, U []T | map[string]T] interface {
	Print(U) error
	Flush()
}

Printer prints a list of values.

func NewJSONPrinter added in v0.1.47

func NewJSONPrinter[T any, U []T | map[string]T](w io.Writer) Printer[T, U]

NewJSONPrinter outputs values as JSON.

func NewMapKeyPrinter added in v0.1.47

func NewMapKeyPrinter[T any, U map[string]T](w io.Writer) Printer[T, U]

NewMapKeyPrinter outputs the keys of a map.

func NewMapTablePrinter added in v0.1.47

func NewMapTablePrinter[T any, U map[string]T](w io.Writer, header []string, rowFunc func(T) []string, printKey bool) Printer[T, U]

NewMapTablePrinter creates a new table printer.

func NewSliceTablePrinter added in v0.1.47

func NewSliceTablePrinter[T any, U []T](w io.Writer, header []string, rowFunc func(T) []string) Printer[T, U]

NewSliceTablePrinter creates a new table printer.

func NewYAMLPrinter added in v0.1.81

func NewYAMLPrinter[T any, U []T | map[string]T](w io.Writer) Printer[T, U]

NewYAMLPrinter outputs values as YAML.

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