confirm

package
v0.0.0-...-b425644 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TypeCreate = iota + 1
	TypeUpdate
	TypeDelete
)

Variables

This section is empty.

Functions

func ActionsDiff

func ActionsDiff(w io.Writer, ctx *ActionsDiffCtx) error

func ConfirmHTML

func ConfirmHTML(actions ...*Action) error

func ConfirmShell

func ConfirmShell(actions ...*Action) error

func WebDiff

func WebDiff(actions []*Action) (chan bool, error)

Types

type Action

type Action struct {
	Title string
	Diff  []byte
	Type  Type
	Call  ActionFunc
}

func New

func New(t Type, title string, diff []byte, f ActionFunc) *Action

func NewCreate

func NewCreate(title string, diff []byte, f ActionFunc) *Action

func NewDelete

func NewDelete(title string, diff []byte, f ActionFunc) *Action

func NewUpdate

func NewUpdate(title string, diff []byte, f ActionFunc) *Action

func (*Action) String

func (s *Action) String() string

type ActionFunc

type ActionFunc func() error

type Actions

type Actions []*Action

func (*Actions) Create

func (list *Actions) Create(title string, diff []byte, f ActionFunc)

func (*Actions) Delete

func (list *Actions) Delete(title string, diff []byte, f ActionFunc)

func (Actions) Exec

func (list Actions) Exec() error

func (Actions) String

func (list Actions) String() string

func (*Actions) Update

func (list *Actions) Update(title string, diff []byte, f ActionFunc)

type ActionsDiffCtx

type ActionsDiffCtx struct {
	Actions []*Action
}

func (*ActionsDiffCtx) ActionString

func (ctx *ActionsDiffCtx) ActionString(a *Action) string

func (*ActionsDiffCtx) ColorizeDiff

func (a *ActionsDiffCtx) ColorizeDiff(in []byte) string

type Type

type Type int

Jump to

Keyboard shortcuts

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