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