input

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2019 License: Unlicense Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInput

func GetInput(prompt, def, after string, limitMax, limitMin int) (b *memguard.LockedBuffer, err error)

GetInput prompts the user for input and then reads a single newline-terminated line from stdin and returns it as a memguard.LockedBuffer with the terminating newline removed.

It also enforces the user to provide a limited number of characters bound by limitMax and limitMin. If an empty input is allowed (indicated by lmitMin = 0) GetInput can optionally return a default value.

func GetMaskedInput

func GetMaskedInput(prompt, def, after string, limitMax, limitMin int) (b *memguard.LockedBuffer, err error)

GetMaskedInput prompts the user for input and then reads a single newline-terminated line from stdin and returns it as a memguard.LockedBuffer with the terminating newline removed. User input is not displayed in the console.

It also enforces the user to provide a limited number of characters bound by limitMax and limitMin. If an empty input is allowed (indicated by lmitMin = 0) GetInput can optionally return a default value.

If standard input is not interactive (ex. redirected from another process) all prompts, limit checks and fallbacks are disabled and raw input is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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