progress

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package progress provides data and functionality to display updates to the terminal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResourceMatcher

type ResourceMatcher func(deploy.Resource) bool

ResourceMatcher is a function that returns true if the resource event matches a criteria.

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() *Spinner

NewSpinner returns a spinner that outputs to stderr.

func (*Spinner) Events

func (s *Spinner) Events(events []TabRow)

Events writes additional information below the spinner while the spinner is still in progress. If there are already existing events under the spinner, it replaces them with the new information.

An event is displayed in a table, where columns are separated with the '\t' character.

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 Status

type Status string

Status is the condition of the progress update.

const (
	StatusInProgress Status = "In Progress"
	StatusFailed     Status = "Failed"
	StatusComplete   Status = "Complete"
	StatusSkipped    Status = "Skipped"
)

Common progression life-cycle for an update.

type TabRow

type TabRow string

TabRow represents a row in a table where columns are separated with a "\t" character.

func HumanizeResourceEvents

func HumanizeResourceEvents(orderedTexts []Text, resourceEvents []deploy.ResourceEvent, matcher map[Text]ResourceMatcher, wantedCount map[Text]int) []TabRow

HumanizeResourceEvents groups raw deploy events under human-friendly tab-separated texts that can be passed into the Events() method. Every text to display starts with status in progress. For every resource event that belongs to a text, we preserve failure events if there was one. Otherwise, the text remains in progress until the expected number of resources reach the complete status.

type Text

type Text string

Text is a description of the progress update.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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