Documentation ¶
Index ¶
- Constants
- Variables
- func NoColor()
- func Run(ctx context.Context, pf progressFunc, out io.Writer) error
- func RunWithStatus(ctx context.Context, pf progressFuncWithStatus, out io.Writer, ...) (string, error)
- func RunWithTitle(ctx context.Context, pf progressFunc, out io.Writer, progressTitle string) error
- func WithContextWriter(ctx context.Context, writer Writer) context.Context
- type Event
- func CreatedEvent(id string) Event
- func CreatingEvent(id string) Event
- func ErrorEvent(id string) Event
- func ErrorMessageEvent(id string, msg string) Event
- func Exited(id string) Event
- func Healthy(id string) Event
- func KilledEvent(id string) Event
- func KillingEvent(id string) Event
- func NewEvent(id string, status EventStatus, statusText string) Event
- func RemovedEvent(id string) Event
- func RemovingEvent(id string) Event
- func RestartedEvent(id string) Event
- func RestartingEvent(id string) Event
- func RunningEvent(id string) Event
- func SkippedEvent(id string, reason string) Event
- func StartedEvent(id string) Event
- func StartingEvent(id string) Event
- func StoppedEvent(id string) Event
- func StoppingEvent(id string) Event
- func Waiting(id string) Event
- type EventStatus
- type Writer
Constants ¶
const ( // ModeAuto detect console capabilities ModeAuto = "auto" // ModeTTY use terminal capability for advanced rendering ModeTTY = "tty" // ModePlain dump raw events to output ModePlain = "plain" // ModeQuiet don't display events ModeQuiet = "quiet" )
Variables ¶
var ( DoneColor colorFunc = aec.BlueF.Apply TimerColor colorFunc = aec.BlueF.Apply CountColor colorFunc = aec.YellowF.Apply WarningColor colorFunc = aec.YellowF.With(aec.Bold).Apply SuccessColor colorFunc = aec.GreenF.Apply ErrorColor colorFunc = aec.RedF.With(aec.Bold).Apply PrefixColor colorFunc = aec.CyanF.Apply )
var Mode = ModeAuto
Mode define how progress should be rendered, either as ModePlain or ModeTTY
Functions ¶
func RunWithStatus ¶
func RunWithStatus(ctx context.Context, pf progressFuncWithStatus, out io.Writer, progressTitle string) (string, error)
RunWithStatus will run a writer and the progress function in parallel and return a status
func RunWithTitle ¶
Types ¶
type Event ¶
type Event struct { ID string ParentID string Text string Status EventStatus StatusText string Current int64 Percent int Total int64 // contains filtered or unexported fields }
Event represents a progress event.
func CreatedEvent ¶
CreatedEvent creates a new Created (done) Event
func CreatingEvent ¶
CreatingEvent creates a new Create in progress Event
func ErrorMessageEvent ¶
ErrorMessageEvent creates a new Error Event with message
func KilledEvent ¶
KilledEvent creates a new Killed in progress Event
func KillingEvent ¶
KillingEvent creates a new Killing in progress Event
func NewEvent ¶
func NewEvent(id string, status EventStatus, statusText string) Event
NewEvent new event
func RemovedEvent ¶
RemovedEvent creates a new removed (done) Event
func RemovingEvent ¶
RemovingEvent creates a new Removing in progress Event
func RestartedEvent ¶
RestartedEvent creates a new Restarted in progress Event
func RestartingEvent ¶
RestartingEvent creates a new Restarting in progress Event
func RunningEvent ¶
RunningEvent creates a new Running in progress Event
func SkippedEvent ¶
SkippedEvent creates a new Skipped Event
func StartedEvent ¶
StartedEvent creates a new Started in progress Event
func StartingEvent ¶
StartingEvent creates a new Starting in progress Event
func StoppedEvent ¶
StoppedEvent creates a new Stopping in progress Event
func StoppingEvent ¶
StoppingEvent creates a new Stopping in 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 // Warning means that the current task has warning Warning // Error means that the current task has errored Error )