interact: github.com/tockins/interact Index | Files

package interact

import "github.com/tockins/interact"

Index

Package Files

args.go context.go interact.go quest.go

func Run Uses

func Run(i *Interact) error

Run a questions list

type BoolFunc Uses

type BoolFunc func(Context) bool

type Cast Uses

type Cast interface {
    Int() (int64, error)
    Bool() (bool, error)
    String() (string, error)
    Float() (float64, error)
    Time() (time.Duration, error)
    Raw() interface{}
}

type Choice Uses

type Choice struct {
    Text     string
    Response interface{}
}

Choice option

type Choices Uses

type Choices struct {
    Alternatives []Choice
    Color        func(...interface{}) string
}

Choices list and prefix color

type Context Uses

type Context interface {
    Skip()
    Reload()
    GetReload() int
    SetPrfx(io.Writer, interface{})
    SetDef(interface{}, interface{})
    SetErr(interface{})
    SetEnd(string)
    Ans() Cast
    Def() Cast
    Err() error
    Parent() Context
    Prfx() Cast
    Qns() Qns
    Tag() string
    Quest() string
}

type ErrorFunc Uses

type ErrorFunc func(Context) error

type Interact Uses

type Interact struct {
    Questions     []*Question
    After, Before ErrorFunc
    // contains filtered or unexported fields
}

Interact element

type InterfaceFunc Uses

type InterfaceFunc func(Context) interface{}

type Interview Uses

type Interview interface {
}

func New Uses

func New(i *Interact) Interview

Create a new interact configuration

type Qns Uses

type Qns interface {
    Size() int
    Anwer() []Cast
    Get(int) Context
    GetTag(string) Context
    List() []Context
    ListTag(string) []Context
}

type Quest Uses

type Quest struct {
    Choices

    Options, Msg, Tag string
    Resolve           BoolFunc
    // contains filtered or unexported fields
}

Question params

type Question Uses

type Question struct {
    Quest

    Action        InterfaceFunc
    Subs          []*Question
    After, Before ErrorFunc
    // contains filtered or unexported fields
}

Question entity

Package interact imports 7 packages (graph) and is imported by 5 packages. Updated 2018-01-27. Refresh now. Tools for package owners.