input

package
v1.9.5 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PortMin = 0     // PortMin is the lowest permitted network port.
	PortMax = 65535 // PortMax is the largest permitted network port.
)

Variables

View Source
var (
	ErrDir      = errors.New("will not save the change as this directory is not found")
	ErrEmpty    = errors.New("empty directory input")
	ErrTooMany  = errors.New("too many stdin tries")
	ErrNoReader = errors.New("reader cannot be nil, it should be os.stdin")
)

Functions

func Dir

func Dir(r io.Reader) (string, error)

Dir parses the reader for a valid directory input. Except for testing, r should always be os.Stdin.

func IsPort

func IsPort(port int) bool

IsPort reports if the port is usable.

func Port

func Port(r io.Reader) (int64, error)

Port parses the reader for a valid network port. Except for testing, r should always be os.Stdin.

func Read

func Read(r io.Reader) (string, error)

Read and trim the reader and return the results.

func String

func String(r io.Reader) (string, error)

String parses the reader, looking for a string and newline. Except for testing, r should always be os.Stdin.

func YN

func YN(s string, emptyIsYes bool) bool

YN parse s for a usable boolean value. An empty string will return true when emptyIsYes is true.

Types

This section is empty.

Jump to

Keyboard shortcuts

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