progress

package
v1.33.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EraseAndRender added in v1.21.0

func EraseAndRender(out FileWriteFlusher, r Renderer, prevNumLines int) (int, error)

EraseAndRender erases prevNumLines from out and then renders r.

func Render added in v1.1.0

Render renders r periodically to out and returns the last number of lines written to out. Render stops when there the ctx is canceled or r is done listening to new events. While Render is executing, the terminal cursor is hidden and updates are written in-place.

Types

type DynamicRenderer added in v1.1.0

type DynamicRenderer interface {
	Renderer
	Done() <-chan struct{}
}

DynamicRenderer is a Renderer that can notify that its internal states are Done updating. DynamicRenderer is implemented by components that listen to events from a streamer and update their state.

func ListeningChangeSetRenderer added in v1.2.0

func ListeningChangeSetRenderer(streamer StackSubscriber, stackName, description string, changes []Renderer, opts RenderOptions) DynamicRenderer

ListeningChangeSetRenderer returns a component that listens for CloudFormation resource events from a stack mutated with a changeSet until the streamer stops.

func ListeningECSServiceResourceRenderer added in v1.2.0

func ListeningECSServiceResourceRenderer(cfg ECSServiceRendererCfg, opts ECSServiceRendererOpts) DynamicRenderer

ListeningECSServiceResourceRenderer is a ListeningResourceRenderer for the ECS service cloudformation resource and a ListeningRollingUpdateRenderer to render deployments.

func ListeningEnvControllerRenderer added in v1.5.0

func ListeningEnvControllerRenderer(conf EnvControllerConfig) DynamicRenderer

ListeningEnvControllerRenderer returns a component that listens and can render CloudFormation resource events from the EnvControllerAction and the environment stack.

func ListeningResourceRenderer added in v1.1.0

func ListeningResourceRenderer(streamer StackSubscriber, logicalID, description string, opts ResourceRendererOpts) DynamicRenderer

ListeningResourceRenderer returns a tab-separated component that listens for CloudFormation stack events for a particular resource.

func ListeningRollingUpdateRenderer added in v1.2.0

func ListeningRollingUpdateRenderer(streamer ECSServiceSubscriber, opts RenderOptions) DynamicRenderer

ListeningRollingUpdateRenderer renders ECS rolling update deployments.

func ListeningStackRenderer added in v1.1.0

func ListeningStackRenderer(streamer StackSubscriber, stackName, description string, resourceDescriptions map[string]string, opts RenderOptions) DynamicRenderer

ListeningStackRenderer returns a component that listens for CloudFormation resource events from a stack mutated with CreateStack or UpdateStack until the stack is completed.

func ListeningStackSetRenderer added in v1.21.1

func ListeningStackSetRenderer(streamer StackSetSubscriber, title string, opts RenderOptions) DynamicRenderer

ListeningStackSetRenderer renders a component that listens for CloudFormation stack set events until the streamer stops.

func MultiRenderer added in v1.21.0

func MultiRenderer(renderers ...DynamicRenderer) DynamicRenderer

MultiRenderer returns a Renderer that's the concatenation of the input renderers. The renderers are rendered sequentially, and the MultiRenderer is only Done once all renderers are Done.

type ECSServiceRendererCfg added in v1.27.0

type ECSServiceRendererCfg struct {
	Streamer    StackSubscriber
	ECSClient   stream.ECSServiceDescriber
	CWClient    stream.CloudWatchDescriber
	LogicalID   string
	Description string
}

ECSServiceRendererCfg holds required configuration for initializing an ECS service renderer.

type ECSServiceRendererOpts added in v1.2.0

type ECSServiceRendererOpts struct {
	Group      *errgroup.Group
	Ctx        context.Context
	RenderOpts RenderOptions
}

ECSServiceRendererOpts holds optional configuration for a listening ECS service renderer.

type ECSServiceSubscriber added in v1.2.0

type ECSServiceSubscriber interface {
	Subscribe() <-chan stream.ECSService
}

ECSServiceSubscriber is the interface to subscribe channels to ECS service descriptions.

type EnvControllerConfig added in v1.5.0

type EnvControllerConfig struct {
	// Common configuration.
	Description string
	RenderOpts  RenderOptions

	// Env controller action configuration.
	ActionStreamer  StackSubscriber
	ActionLogicalID string

	// Env stack configuration.
	EnvStreamer     StackSubscriber
	CancelEnvStream context.CancelFunc
	EnvStackName    string
	EnvResources    map[string]string
}

EnvControllerConfig holds the required parameters to create an environment controller component.

type FileWriteFlusher added in v1.1.0

type FileWriteFlusher interface {
	FileWriter
	WriteFlusher
}

FileWriteFlusher is the interface that groups a FileWriter and WriteFlusher.

type FileWriter added in v1.1.0

type FileWriter interface {
	io.Writer
	Fd() uintptr
}

FileWriter is the interface grouping an io.Writer with the file descriptor method Fd. Files in the OS, like os.Stderr, implement the FileWriter interface.

type RenderOptions added in v1.1.0

type RenderOptions struct {
	Padding int // Leading spaces before rendering the component.
}

RenderOptions holds optional style configuration for renderers.

func NestedRenderOptions added in v1.1.0

func NestedRenderOptions(opts RenderOptions) RenderOptions

NestedRenderOptions takes a RenderOptions and returns the same RenderOptions but with additional padding.

type Renderer added in v1.1.0

type Renderer interface {
	Render(out io.Writer) (numLines int, err error)
}

Renderer is the interface to print a component to a writer. It returns the number of lines printed and the error if any.

func LineRenderer added in v1.21.0

func LineRenderer(text string, padding int) Renderer

LineRenderer returns a Renderer that can display a single line of text.

type ResourceRendererOpts added in v1.2.0

type ResourceRendererOpts struct {
	StartEvent *stream.StackEvent // Specify the starting event for the resource instead of "[not started]".
	RenderOpts RenderOptions
}

ResourceRendererOpts is optional configuration for a listening CloudFormation resource renderer.

type Spinner

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

Spinner represents an indicator that an asynchronous operation is taking place.

For short operations, less than 4 seconds, display only the spinner with the Start and Stop methods. For longer operations, display intermediate progress events using the Events method.

func NewSpinner

func NewSpinner(w io.Writer) *Spinner

NewSpinner returns a spinner that outputs to w.

func (*Spinner) Start

func (s *Spinner) Start(label string)

Start starts the spinner suffixed with a label.

func (*Spinner) Stop

func (s *Spinner) Stop(label string)

Stop stops the spinner and replaces it with a label.

type StackSetSubscriber added in v1.21.1

type StackSetSubscriber interface {
	Subscribe() <-chan stream.StackSetOpEvent
}

StackSetSubscriber is the interface to subscribe channels to a CloudFormation stack set event stream.

type StackSubscriber added in v1.1.0

type StackSubscriber interface {
	Subscribe() <-chan stream.StackEvent
}

StackSubscriber is the interface to subscribe to a CloudFormation stack event stream.

type TabbedFileWriter added in v1.1.0

type TabbedFileWriter struct {
	FileWriter
	WriteFlusher
}

TabbedFileWriter is a FileWriter that also implements the WriteFlusher interface. A TabbedFileWriter can properly align text separated by the '\t' character.

func NewTabbedFileWriter added in v1.1.0

func NewTabbedFileWriter(fw FileWriter) *TabbedFileWriter

NewTabbedFileWriter takes a file as input and returns a FileWriteFlusher that can properly write tab-separated text to it.

func (*TabbedFileWriter) Write added in v1.1.0

func (w *TabbedFileWriter) Write(p []byte) (n int, err error)

type WriteFlusher added in v1.1.0

type WriteFlusher interface {
	io.Writer
	Flush() error
}

WriteFlusher is the interface grouping an io.Writer with the Flush method. Flush allows writing buffered writes from Writer all at once.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package summarybar provides renderers for summary bar.
Package summarybar provides renderers for summary bar.

Jump to

Keyboard shortcuts

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