input

package
v1.0.0-bc9 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2019 License: Apache-2.0 Imports: 8 Imported by: 6

Documentation

Overview

Package input provides a series of functions and structures to read and process i/o from readers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFileOrReader

func NewFileOrReader(reader io.Reader, filename string) (io.ReadCloser, error)

NewFileOrReader tries to open a file if a non empty filename is passed as a parameter, otherwise a reader passed as the first argument is to be read and copied in a buffer that is returned. Any error along the way is returned.

Types

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

Scanner masks an io.Reader and an output.Device so that the output.Device can be paused before the Scanners input can be parsed.

func NewScanner

func NewScanner(reader io.Reader, device *output.Device) *Scanner

NewScanner instantiates a new Scanner from an io.Reader and output.Device.

func (*Scanner) Scan

func (s *Scanner) Scan(text string) string

Scan scans the input that Scanner is wrapping first printing a statement to the output.Device so that the user can understand what it has to type. Only one concurrent scan is allowed to happen at any time in the same Scanner.

Jump to

Keyboard shortcuts

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