prompt

package
v0.0.35 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: LGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package prompt inputs for user interactions.

Index

Examples

Constants

View Source
const (
	PortMin  uint = 1 // port 0 is not valid as viper treats it as a null value
	PortMax  uint = 65535
	NoChange      = "no changes applied"
)

the lowest, largest and recommended network ports to serve HTTP.

Variables

View Source
var (
	ErrNoReader = errors.New("reader interface is empty")
	ErrPString  = errors.New("prompt string standard input problem")
)

Functions

func CtrlC added in v0.0.33

func CtrlC()

CtrlC intercepts any Ctrl-C keyboard input and exits to the shell.

func IndexStrings

func IndexStrings(options *[]string, setup bool) string

IndexStrings asks for a numeric index position and returns a single choice from a string of keys.

func Port

func Port(validate, setup bool) (port uint)

Port asks for and returns a HTTP port value.

func PortValid

func PortValid(port uint) (ok bool)

PortValid checks if the network port is within range to serve HTTP.

func ShortStrings

func ShortStrings(options *[]string) string

ShortStrings asks for and returns a single choice from a string of keys. Either the first letter or the full name of the key are accepted.

func SkipSet added in v0.0.33

func SkipSet(setup bool) string

SkipSet returns a skipped setting string for the setup walk through.

func String

func String() (words string)

String asks for and returns a multi-word string. Inputting ⏎ the Enter/Return key exits the program, or returns an empty value when in SetupMode.

func Strings

func Strings(options *[]string, setup bool) string

Strings asks for and returns a single choice from a string of keys.

func YesNo

func YesNo(ask string, yesDefault bool) bool

YesNo asks for a yes or no input.

Example
yn := YesNo("Say hello", true)
fmt.Print(yn)
Output:

Say hello? [Yes/no] true

Types

This section is empty.

Jump to

Keyboard shortcuts

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