Documentation ¶
Index ¶
- Variables
- func AddMessageRendererToContext(ctx context.Context, messageRenderer MessageRenderer) context.Context
- func AddSnapshotProgressToContext(ctx context.Context, snapshotProgress SnapshotProgress) context.Context
- func AddStatusHooksToContext(ctx context.Context, statusHooks StatusHooks) context.Context
- func DisableStatusHooks(ctx context.Context) context.Context
- func Done(ctx context.Context)
- func Message(ctx context.Context, msgs ...string)
- func SetStatus(ctx context.Context, msg string)
- func Show(ctx context.Context)
- func SnapshotError(ctx context.Context)
- func UpdateSnapshotProgress(ctx context.Context, completedRows int)
- func Warn(ctx context.Context, warning string)
- type MessageRenderer
- type NullSnapshotProgress
- type NullStatusHook
- type SnapshotProgress
- type SnapshotProgressReporter
- type StatusHooks
- type StatusSpinner
- type StatusSpinnerOpt
Constants ¶
This section is empty.
Variables ¶
View Source
var NullProgress = &NullSnapshotProgress{}
NullProgress is an empty implementation of SnapshotProgress
Functions ¶
func AddMessageRendererToContext ¶
func AddMessageRendererToContext(ctx context.Context, messageRenderer MessageRenderer) context.Context
func AddSnapshotProgressToContext ¶
func AddSnapshotProgressToContext(ctx context.Context, snapshotProgress SnapshotProgress) context.Context
func AddStatusHooksToContext ¶
func AddStatusHooksToContext(ctx context.Context, statusHooks StatusHooks) context.Context
func SnapshotError ¶
func UpdateSnapshotProgress ¶
Types ¶
type MessageRenderer ¶
func MessageRendererFromContext ¶
func MessageRendererFromContext(ctx context.Context) MessageRenderer
type NullSnapshotProgress ¶
type NullSnapshotProgress struct{}
func (*NullSnapshotProgress) UpdateErrorCount ¶
func (*NullSnapshotProgress) UpdateErrorCount(context.Context, int)
func (*NullSnapshotProgress) UpdateRowCount ¶
func (*NullSnapshotProgress) UpdateRowCount(context.Context, int)
type NullStatusHook ¶
type NullStatusHook struct{}
func (*NullStatusHook) Hide ¶
func (*NullStatusHook) Hide()
func (*NullStatusHook) Message ¶
func (*NullStatusHook) Message(...string)
func (*NullStatusHook) SetStatus ¶
func (*NullStatusHook) SetStatus(string)
func (*NullStatusHook) Show ¶
func (*NullStatusHook) Show()
func (*NullStatusHook) Warn ¶
func (*NullStatusHook) Warn(string)
type SnapshotProgress ¶
type SnapshotProgress interface { UpdateRowCount(context.Context, int) UpdateErrorCount(context.Context, int) }
func SnapshotProgressFromContext ¶
func SnapshotProgressFromContext(ctx context.Context) SnapshotProgress
type SnapshotProgressReporter ¶
type SnapshotProgressReporter struct {
// contains filtered or unexported fields
}
SnapshotProgressReporter is an implementation of SnapshotProgress
func NewSnapshotProgressReporter ¶
func NewSnapshotProgressReporter(target string) *SnapshotProgressReporter
func (*SnapshotProgressReporter) UpdateErrorCount ¶
func (r *SnapshotProgressReporter) UpdateErrorCount(ctx context.Context, errors int)
func (*SnapshotProgressReporter) UpdateRowCount ¶
func (r *SnapshotProgressReporter) UpdateRowCount(ctx context.Context, rows int)
type StatusHooks ¶
var NullHooks StatusHooks = &NullStatusHook{}
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 NewStatusSpinnerHook ¶
func NewStatusSpinnerHook(opts ...StatusSpinnerOpt) *StatusSpinner
this is used in the root command to setup a default cmd execution context with a status spinner built in to update this, use the statushooks.AddStatusHooksToContext
We should never create a StatusSpinner directly. To use a spinner DO NOT use a StatusSpinner directly, since using it may have unintended side-effect around the spinner lifecycle
func (*StatusSpinner) Message ¶
func (s *StatusSpinner) Message(msgs ...string)
func (*StatusSpinner) SetStatus ¶
func (s *StatusSpinner) SetStatus(msg string)
SetStatus implements StatusHooks
func (*StatusSpinner) Show ¶
func (s *StatusSpinner) Show()
func (*StatusSpinner) UpdateSpinnerMessage ¶
func (s *StatusSpinner) UpdateSpinnerMessage(newMessage string)
UpdateSpinnerMessage updates the message of the given spinner
func (*StatusSpinner) Warn ¶
func (s *StatusSpinner) Warn(msg string)
type StatusSpinnerOpt ¶
type StatusSpinnerOpt func(*StatusSpinner)
func WithDelay ¶
func WithDelay(delay time.Duration) StatusSpinnerOpt
func WithMessage ¶
func WithMessage(msg string) StatusSpinnerOpt
Click to show internal directories.
Click to hide internal directories.