mcchunkie/pass_reader.go
2021-03-28 14:28:58 -06:00

20 lines
296 B
Go

package main
import (
"os"
"golang.org/x/term"
)
//noinspection GoUnresolvedReference
func prompt(p string) (string, error) {
oldState, err := term.MakeRaw(0)
if err != nil {
panic(err)
}
defer term.Restore(0, oldState)
t := term.NewTerminal(os.Stdin, p)
return t.ReadPassword(p)
}