es_dialogue

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NonEmptyText

func NonEmptyText(t string) (s string, valid bool)

func YesNoCont

func YesNoCont(t string) (cont, valid bool)

Types

type Dialogue

type Dialogue interface {
	// Ask weak confirmation to proceed the operation.
	// Prompt message could be like "hit any key to proceed".
	AskProceed(p Prompt)

	// Ask sticky confirmation to proceed the operation.
	AskCont(p Prompt, v VerifyCont) (c bool)

	// Ask text
	AskText(p Prompt, v VerifyText) (t string, cancel bool)

	// Ask secure text (text should not echo back)
	// Always read from os.Stdin
	AskSecure(p Prompt) (t string, cancel bool)
}

func DenyAll

func DenyAll() Dialogue

func New

func New(w io.Writer) Dialogue

type Prompt

type Prompt func()

type VerifyCont

type VerifyCont func(t string) (cont, valid bool)

Return result in cont. Return valid = false when given t is invalid. The value cont is not used when valid == false.

type VerifyText

type VerifyText func(t string) (s string, valid bool)

Ensure the text is valid format or not.

Jump to

Keyboard shortcuts

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