checklist

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: Apache-2.0 Imports: 14 Imported by: 1

README

checklist

A utility that waits for the readiness of a list of conditions and prints it in a pretty format

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckList

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

CheckList holds the state of a check list

func NewCheckList

func NewCheckList(w io.Writer, headers ListItemInfo, items []Checker, opts *CheckListOptions) *CheckList

NewCheckList creates a new checklist

func (*CheckList) Start

func (cl *CheckList) Start(ctx context.Context) error

Start starts the checklist

type CheckListOptions

type CheckListOptions struct {
	// Interval to refresh the checklist default is 500ms
	Interval time.Duration
	// StateIconMap the icon to display for each item state
	StateIconMap map[ListItemState]string
	// NoColor if true will not use colors at all
	NoColor bool
	// Fullscreen if true will clear all screen each refresh
	Fullscreen bool
	// ClearAfter if true will clear the check list from the
	// screen after all the checks are done
	ClearAfter bool
	// WaitAllReady if true will not stop the checklist until
	// all items are in ready state instead of waiting for
	// ready or error state
	WaitAllReady bool
}

CheckListOptions options to create a new check list

type Checker

type Checker func(ctx context.Context) (ListItemState, ListItemInfo)

Checker a function used to check the current state and info of a single list item

type ListItemInfo

type ListItemInfo []string

ListItemInfo holds the values for all the table columns for a single list item

type ListItemState

type ListItemState string

ListItemState holds the state of a list item

const (
	// Waiting for the item to be ready
	Waiting ListItemState = "Waiting"
	// Ready item is ready
	Ready ListItemState = "Ready"
	// Error item checker returns some error
	Error ListItemState = "Error"
)

Item states

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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