Documentation ¶
Overview ¶
Package nobufio provides non-buffered io operations.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoTerminal = errors.New("ReadPasswordStrict: Reader is not a terminal")
ErrNoTerminal is returned by ReadPasswordStrict when stdin is not a terminal
Functions ¶
func ReadLine ¶
ReadLine reads the current line from the provided reader.
A line is considered to end when one of the following is encountered: '\r\n', '\n' or EOF or '\r' followed by EOF. Note that only a '\r' is not considered an end-of-line.
The returned line never contains the end-of-line markers, such as '\n' or '\r\n'. A line may be empty, however when only EOF is read, returns "", EOF.
Example ¶
input := strings.NewReader("line1\nline2\r\n\n\r\nline5") fmt.Println(ReadLine(input)) fmt.Println(ReadLine(input)) fmt.Println(ReadLine(input)) fmt.Println(ReadLine(input)) fmt.Println(ReadLine(input)) fmt.Println(ReadLine(input))
Output: line1 <nil> line2 <nil> <nil> <nil> line5 <nil> EOF
func ReadPassword ¶
ReadPassword is like ReadLine, except that it turns off terminal echo. When reader is not a terminal, behaves like ReadLine
func ReadPasswordStrict ¶
ReadPasswordSrict is like ReadPassword, except that when reader is not a terminal, returns ErrNoTerminal.
Types ¶
This section is empty.