cli

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithContext

func WithContext(f func(context.Context, *errgroup.Group) error) error

WithContext runs f with an errgroup.Group and a context. The context is cancelled when SIGINT is received or f returns. WithContext returns the error from the error group.

Types

type LogTerminal

type LogTerminal struct {
	*termstatus.Terminal
	io.Writer
}

LogTerminal writes data to a second writer in addition to the terminal.

func (*LogTerminal) Print

func (lt *LogTerminal) Print(msg string)

Print prints a message.

func (*LogTerminal) Printf

func (lt *LogTerminal) Printf(msg string, data ...interface{})

Printf prints a message with formatting.

type StdioWrapper

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

StdioWrapper provides stdout and stderr integration with termstatus.

func NewStdioWrapper

func NewStdioWrapper(term Terminal) *StdioWrapper

NewStdioWrapper initializes a new stdio wrapper that can be used in place of os.Stdout or os.Stderr.

func (*StdioWrapper) Stderr

func (w *StdioWrapper) Stderr() io.WriteCloser

Stderr returns a writer that is line buffered and can be used in place of os.Stderr. On Close(), the remaining bytes are written, followed by a line break.

func (*StdioWrapper) Stdout

func (w *StdioWrapper) Stdout() io.WriteCloser

Stdout returns a writer that is line buffered and can be used in place of os.Stdout. On Close(), the remaining bytes are written, followed by a line break.

type Terminal

type Terminal interface {
	Printf(msg string, data ...interface{})
	Print(msg string)
	SetStatus([]string)
	Run(context.Context)
}

Terminal prints data with intermediate status.

Jump to

Keyboard shortcuts

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