activekit

package
v3.5.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2018 License: MIT Imports: 9 Imported by: 25

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AskFieldToChange

func AskFieldToChange(fields []string) (int, bool)

func AskLine

func AskLine(promt string) (string, bool)

func AskWord

func AskWord(message string) (string, bool)

func Attention

func Attention(f string, args ...interface{})

func HandleString

func HandleString(promt string, handler func(string) bool) func() error

func Input

func Input() string

func IsStop

func IsStop(word string) bool

func Options

func Options(msg string, withStop bool, options ...string) (string, int, bool)

func OrString

func OrString(str, def string, args ...interface{}) string

func OrStringer

func OrStringer(str fmt.Stringer, def string, args ...interface{}) string

func OrValue

func OrValue(val interface{}, def string, args ...interface{}) string

func Promt

func Promt(promt string, vars ...interface{}) string

func Yes

func Yes(message string) (bool, string)

func YesNo

func YesNo(promt string, args ...interface{}) bool

Types

type Action

type Action interface {
	Run() (bool, error)
}

type ActionFull

type ActionFull func() (bool, error)

func (ActionFull) Run

func (action ActionFull) Run() (bool, error)

type ActionSimple

type ActionSimple func()

func (ActionSimple) Run

func (action ActionSimple) Run() (bool, error)

type ActionWithErr

type ActionWithErr func() error

func (ActionWithErr) Run

func (action ActionWithErr) Run() (bool, error)
type Menu struct {
	Title               string
	Promt               string
	History             []string
	Items               MenuItems
	CustomOptionHandler func(string) error
	// contains filtered or unexported fields
}
func (menu *Menu) Run() (*MenuItem, error)
type MenuItem struct {
	Label  string
	Action func() error
}
func (item *MenuItem) String() string
type MenuItems []*MenuItem

func ItemsFromIter

func ItemsFromIter(maxIndex uint, next func(index uint) *MenuItem) MenuItems

func StringSelector

func StringSelector(items []string, action func(string) error) MenuItems
func (items MenuItems) Append(newItems ...*MenuItem) MenuItems
func (items MenuItems) Copy() MenuItems
func (items MenuItems) Delete(i int) MenuItems
func (items MenuItems) Labels() []string
func (items MenuItems) Len() int
func (items MenuItems) NotNil() MenuItems

type Recounter

type Recounter struct {
	Re io.Reader
	// contains filtered or unexported fields
}

func (*Recounter) Read

func (re *Recounter) Read(p []byte) (int, error)

func (*Recounter) Sum

func (re *Recounter) Sum() int64

Jump to

Keyboard shortcuts

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