progress

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render added in v1.1.0

Render renders r periodically 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(streamer StackSubscriber, ecsDescriber stream.ECSServiceDescriber, logicalID, description string, 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.

type ECSServiceRendererOpts added in v1.2.0

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

ECSServiceRendererOpts is 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.

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 StackSubscriber added in v1.1.0

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

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

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