interactive

package
v2.5.4 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// IsInteractive must be set to print anything with Printer functions (Print, Printf,...).
	IsInteractive = isInteractive()
)

Functions

func Center

func Center(str string) string

func Indent

func Indent(str string, indent int) string

func InjectMockResponseToContext

func InjectMockResponseToContext(ctx context.Context, mockValues []string) context.Context

func Line

func Line(char string) string

func Print

func Print(a ...interface{}) (int, error)

func Printf

func Printf(format string, a ...interface{}) (int, error)

func Println

func Println(a ...interface{}) (int, error)

func PrintlnWithoutIndent

func PrintlnWithoutIndent(a string) (int, error)

func PromptBoolWithConfig

func PromptBoolWithConfig(config *PromptBoolConfig) (bool, error)

func PromptPasswordWithConfig

func PromptPasswordWithConfig(config *PromptPasswordConfig) (string, error)

func PromptStringWithConfig

func PromptStringWithConfig(config *PromptStringConfig) (string, error)

func Readline

func Readline(config *ReadlineConfig) (string, error)

func RemoveIndent

func RemoveIndent(str string) string

func SetOutputWriter

func SetOutputWriter(w io.Writer)

SetOutputWriter set the output writer that will be used by both Printer functions (Print, Printf,...) and readline prompter. This should be called once from the bootstrap function.

Types

type EOFError

type EOFError struct{}

func (*EOFError) Error

func (e *EOFError) Error() string

type InterruptError

type InterruptError struct{}

func (*InterruptError) Error

func (e *InterruptError) Error() string

func (*InterruptError) MarshalHuman

func (e *InterruptError) MarshalHuman() string

type PromptBoolConfig

type PromptBoolConfig struct {
	Ctx          context.Context
	Prompt       string
	DefaultValue bool
}

type PromptPasswordConfig

type PromptPasswordConfig struct {
	Ctx    context.Context
	Prompt string
}

type PromptStringConfig

type PromptStringConfig struct {
	Ctx             context.Context
	Prompt          string
	DefaultValue    string
	DefaultValueDoc string
	ValidateFunc    ValidateFunc
}

type ReadlineConfig

type ReadlineConfig struct {
	Ctx          context.Context
	Prompt       string
	PromptFunc   func(string) string
	Password     bool
	ValidateFunc ValidateFunc
	DefaultValue string
}

type ReadlineHandler

type ReadlineHandler struct {
	// contains filtered or unexported fields
}

func (*ReadlineHandler) SetPrompt

func (h *ReadlineHandler) SetPrompt(prompt string)

type ValidateFunc

type ValidateFunc func(string) error

func ValidateOrganizationID

func ValidateOrganizationID() ValidateFunc

Jump to

Keyboard shortcuts

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