2020-01-29 16:57:42 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"golang.org/x/crypto/ssh/terminal"
|
|
|
|
)
|
|
|
|
|
2020-05-13 17:36:26 -06:00
|
|
|
//noinspection GoUnresolvedReference
|
2020-01-29 16:57:42 -07:00
|
|
|
func prompt(p string) (string, error) {
|
|
|
|
oldState, err := terminal.MakeRaw(0)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
defer terminal.Restore(0, oldState)
|
|
|
|
|
|
|
|
t := terminal.NewTerminal(os.Stdin, p)
|
|
|
|
return t.ReadPassword(p)
|
|
|
|
}
|