statushooks

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NullHooks = &NullStatusHook{}

Functions

func AddMessageRendererToContext added in v0.16.0

func AddMessageRendererToContext(ctx context.Context, messageRenderer MessageRenderer) context.Context

func AddStatusHooksToContext

func AddStatusHooksToContext(ctx context.Context, statusHooks StatusHooks) context.Context

func DisableStatusHooks

func DisableStatusHooks(ctx context.Context) context.Context

func Done

func Done(ctx context.Context)

func Message

func Message(ctx context.Context, msgs ...string)

func SetStatus

func SetStatus(ctx context.Context, msg string)

Types

type MessageRenderer added in v0.16.0

type MessageRenderer func(format string, a ...any)

func MessageRendererFromContext added in v0.16.0

func MessageRendererFromContext(ctx context.Context) MessageRenderer

type NullStatusHook

type NullStatusHook struct{}

func (*NullStatusHook) Done

func (*NullStatusHook) Done()

func (*NullStatusHook) Message

func (*NullStatusHook) Message(...string)

func (*NullStatusHook) SetStatus

func (*NullStatusHook) SetStatus(string)

type StatusHooks

type StatusHooks interface {
	SetStatus(string)
	Done()
	Message(...string)
}

func StatusHooksFromContext

func StatusHooksFromContext(ctx context.Context) StatusHooks

type StatusSpinner

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

StatusSpinner is a struct which implements StatusHooks, and uses a spinner to display status messages

func NewStatusSpinner

func NewStatusSpinner(opts ...StatusSpinnerOpt) *StatusSpinner

func (*StatusSpinner) Done

func (s *StatusSpinner) Done()

Done implements StatusHooks

func (*StatusSpinner) Message

func (s *StatusSpinner) Message(msgs ...string)

func (*StatusSpinner) SetStatus

func (s *StatusSpinner) SetStatus(msg string)

SetStatus implements StatusHooks

func (*StatusSpinner) UpdateSpinnerMessage

func (s *StatusSpinner) UpdateSpinnerMessage(newMessage string)

UpdateSpinnerMessage updates the message of the given spinner

type StatusSpinnerOpt

type StatusSpinnerOpt func(*StatusSpinner)

func WithDelay

func WithDelay(delay time.Duration) StatusSpinnerOpt

func WithMessage

func WithMessage(msg string) StatusSpinnerOpt

Jump to

Keyboard shortcuts

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