progress

package
v0.1.22 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2020 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, pf progressFunc) (string, error)

Run will run a writer and the progress function in parallel

func WithContextWriter

func WithContextWriter(ctx context.Context, writer Writer) context.Context

WithContextWriter adds the writer to the context

Types

type Event

type Event struct {
	ID         string
	Text       string
	Status     EventStatus
	StatusText string
	Done       bool
	// contains filtered or unexported fields
}

Event reprensents a progress event

type EventStatus

type EventStatus int

EventStatus indicates the status of an action

const (
	// Working means that the current task is working
	Working EventStatus = iota
	// Done means that the current task is done
	Done
	// Error means that the current task has errored
	Error
)

type Writer

type Writer interface {
	Start(context.Context) error
	Stop()
	Event(Event)
}

Writer can write multiple progress events

func ContextWriter

func ContextWriter(ctx context.Context) Writer

ContextWriter returns the writer from the context

func NewWriter

func NewWriter(out console.File) (Writer, error)

NewWriter returns a new multi-progress writer

Jump to

Keyboard shortcuts

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