Documentation
¶
Overview ¶
Package clireader provides an io.Reader intended to simulate newline delimited input from the command line.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader implements an io.Reader intended to simulate newline delimited input from the command line. A Reader is constructed by providing a list of strings. Each call to Read will return a string from the provided list, in order, with a newline appended, along with an error value of io.EOF to signal the end of the current input. Once all strings have been read, calling Read stops reading bytes and returns (0, io.EOF) to signal that the reader has been exhausted.
func New ¶
New returns a *Reader configured to return a string from the provided list, in order, with a newline appended, for each call to Read.
func (*Reader) Read ¶
Read copies up to len(buf) bytes from the Reader into buf, and returns the number of bytes copied along with any error.
If the number of bytes returned is greater than 0, and the returned error is nil, there are more bytes to be read from the current input.
If the number of bytes returned is greater than 0, and the returned error is io.EOF the current input is complete, and the reader will be advanced to the next input.
If the number of bytes returned is 0, and the returned error is io.EOF, the reader has been exhausted.