interactive

package
v1.1.12 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxLength = func(length int) Validator {
	return Validator(survey.MaxLength(length))
}

Functions

func AddFlag

func AddFlag(flags *pflag.FlagSet)

AddFlag adds the interactive flag to the given set of command line flags.

func Enable

func Enable()

Enables the interactive mode

func Enabled

func Enabled() bool

Enabled retursn a boolean flag that indicates if the interactive mode is enabled.

func GetBool

func GetBool(input Input) (a bool, err error)

Asks for true/false value in the command line

func GetCert

func GetCert(input Input) (a string, err error)

Gets path to certificate file from the command line

func GetFloat added in v1.0.0

func GetFloat(input Input) (a float64, err error)

Gets float number input from the command line

func GetIPNet

func GetIPNet(input Input) (a net.IPNet, err error)

Asks for CIDR value in the command line

func GetInt

func GetInt(input Input) (a int, err error)

Gets int number input from the command line

func GetMultipleOptions

func GetMultipleOptions(input Input) ([]string, error)

Asks for multiple options selection

func GetOption

func GetOption(input Input) (a string, err error)

Asks for option selection in the command line

func GetPassword

func GetPassword(input Input) (a string, err error)

Gets password input from the command line

func GetString

func GetString(input Input) (a string, err error)

Gets string input from the command line

func IsCIDR added in v1.1.1

func IsCIDR(val interface{}) error

func IsCert added in v1.1.1

func IsCert(filepath interface{}) error

IsCert validates whether the given filepath is a valid cert file

func IsURL added in v1.1.1

func IsURL(val interface{}) error

IsURL validates whether the given value is a valid URL

func PrintHelp

func PrintHelp(help Help) error

Types

type Help

type Help struct {
	Message string
	Steps   []string
}

type Input

type Input struct {
	Question   string
	Help       string
	Options    []string
	Default    interface{}
	Required   bool
	Validators []Validator
}

type Validator added in v1.1.1

type Validator survey.Validator

func RegExp added in v1.1.1

func RegExp(restr string) Validator

func RegExpBoolean added in v1.1.2

func RegExpBoolean(restr string) Validator

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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