Source File
util.go
Belonging Package
github.com/charmbracelet/x/term
package termimport ()// readPasswordLine reads from reader until it finds \n or io.EOF.// The slice returned does not include the \n.// readPasswordLine also ignores any \r it finds.// Windows uses \r as end of line. So, on Windows, readPasswordLine// reads until it finds \r and ignores any \n it finds during processing.func ( io.Reader) ([]byte, error) {var [1]bytevar []bytefor {, := .Read([:])if > 0 {switch [0] {case '\b':if len() > 0 {= [:len()-1]}case '\n':if runtime.GOOS != "windows" {return , nil}// otherwise ignore \ncase '\r':if runtime.GOOS == "windows" {return , nil}// otherwise ignore \rdefault:= append(, [0])}continue}if != nil {if == io.EOF && len() > 0 {return , nil}return , //nolint:wrapcheck}}}
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64)