Documentation ¶
Index ¶
- func Fmt(template string, data interface{}) string
- type Bar
- type Ctx
- func (ctx *Ctx) Ask(label string) (input string, err error)
- func (ctx *Ctx) AskDefault(label, what string) (string, error)
- func (ctx *Ctx) AskFile(label string) (string, error)
- func (ctx *Ctx) Confirm(question string) (bool, error)
- func (ctx *Ctx) ConfirmSelect(label string, dflt bool) (bool, error)
- func (ctx *Ctx) Debreif(errors map[string]error) error
- func (ctx *Ctx) InFrame(title string, fn FrameFunc) error
- func (ctx *Ctx) NewProgressGroup() *ProgressGroup
- func (ctx *Ctx) NewSpinGroup() *SpinGroup
- func (ctx *Ctx) Password(label string) (string, error)
- func (ctx *Ctx) Progress(total float64, fn func(*Ctx, *Bar) error) error
- func (ctx *Ctx) Select(label string, items []string) (int, string, error)
- func (ctx *Ctx) SelectMultiple(label string, items []string) ([]int, []string, error)
- func (ctx *Ctx) Spinner(title string, fn func(*Spinner) error) error
- type Frame
- type FrameFunc
- type GroupError
- type ProgressGroup
- type Select
- type SpinGroup
- type Spinner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bar ¶
type Bar struct { Title string DoneBar string RestBar string Prefix string Percent string // contains filtered or unexported fields }
Bar is a single progress bar
type Ctx ¶
Ctx allows use to keep a root object for all elements
func (*Ctx) Ask ¶
Ask will prompt the user for a string input and will not return until a value is passed. If the value is an empty string, the user will be re-prompted.
func (*Ctx) AskDefault ¶
AskDefault will prompt the user for a string input. If the input is an empty string then the defalt value will be returned
func (*Ctx) Confirm ¶
Confirm will as a yes or no question and wait for an answer that is one of those.
func (*Ctx) ConfirmSelect ¶ added in v0.0.2
ConfirmSelect will prompt the user with a yes/no option. The dflt setting will decide if the first option is yes or no so that the user can just press enter
func (*Ctx) Debreif ¶
Debreif is a convienience method to format multi error return from spin groups and progress groups, it will also return the first error for returning errors inside frames
func (*Ctx) NewProgressGroup ¶
func (ctx *Ctx) NewProgressGroup() *ProgressGroup
NewProgressGroup will create a new progress bar group the will track multiple bars
func (*Ctx) NewSpinGroup ¶
NewSpinGroup creates a new group of spinners to track multiple statuses
func (*Ctx) Select ¶
Select will propt the user with a list and will allow them to select a single option
func (*Ctx) SelectMultiple ¶
SelectMultiple will propt the user with a list and will allow them to select multiple options
type Frame ¶
type Frame struct {
// contains filtered or unexported fields
}
Frame is a box around output that can be nested
func (*Frame) SetCloseTitle ¶
SetCloseTitle sets a label that will show on the closing divider
func (*Frame) SetShowElapsed ¶ added in v0.0.2
SetShowElapsed enabled/disables showing the elapsed time when the frame is closed
type GroupError ¶ added in v0.0.2
GroupError will combine errors for a group of concurrent jobs and make them act as a single error but with the ability to still access the errors
func (*GroupError) Error ¶ added in v0.0.2
func (err *GroupError) Error() string
type ProgressGroup ¶
type ProgressGroup struct { Items []*Bar // contains filtered or unexported fields }
ProgressGroup tracks a group of progress bars
func (*ProgressGroup) Error ¶ added in v0.0.2
func (pg *ProgressGroup) Error() error
func (*ProgressGroup) Wait ¶
func (pg *ProgressGroup) Wait()
Wait will pause until all of the progress bars are complete
type Select ¶
type Select struct {
// contains filtered or unexported fields
}
Select represents a list of items used to enable selections, they can be used as search engines, menus or as a list of items in a cli based prompt.