textio

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Choose

func Choose(ctx context.Context, choices []string, prompt string) (string, bool)

Choose presents a user with a set of valid choices, but also allows making another choice.

func ReadLine

func ReadLine(ctx context.Context, prompt string) string

ReadLine reads a line from stdin and returns it as string.

func ReadLineWithDefault

func ReadLineWithDefault(ctx context.Context, prompt, defaultValue string) string

ReadLineWithDefault acts as ReadLine() but returns a default value when the user presses enter.

func ReadNonNegativeInt

func ReadNonNegativeInt(ctx context.Context, prompt string, defaultZero bool) int

ReadNonNegativeInt reads a line from stdin and returns it as int.

func StrMap

func StrMap(choices []string) map[string]bool

StrMap turns an array of strings into a map from those strings to true

Types

This section is empty.

Jump to

Keyboard shortcuts

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