switch to x/term
This commit is contained in:
parent
e90e928943
commit
e87798cefd
2
go.mod
2
go.mod
@ -9,6 +9,6 @@ require (
|
|||||||
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
|
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
|
||||||
golang.org/x/net v0.0.0-20210326220855-61e056675ecf
|
golang.org/x/net v0.0.0-20210326220855-61e056675ecf
|
||||||
golang.org/x/sys v0.0.0-20210326220804-49726bf1d181 // indirect
|
golang.org/x/sys v0.0.0-20210326220804-49726bf1d181 // indirect
|
||||||
golang.org/x/term v0.0.0-20210317153231-de623e64d2a6 // indirect
|
golang.org/x/term v0.0.0-20210317153231-de623e64d2a6
|
||||||
suah.dev/protect v1.0.0
|
suah.dev/protect v1.0.0
|
||||||
)
|
)
|
||||||
|
@ -3,17 +3,17 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"golang.org/x/crypto/ssh/terminal"
|
"golang.org/x/term"
|
||||||
)
|
)
|
||||||
|
|
||||||
//noinspection GoUnresolvedReference
|
//noinspection GoUnresolvedReference
|
||||||
func prompt(p string) (string, error) {
|
func prompt(p string) (string, error) {
|
||||||
oldState, err := terminal.MakeRaw(0)
|
oldState, err := term.MakeRaw(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
defer terminal.Restore(0, oldState)
|
defer term.Restore(0, oldState)
|
||||||
|
|
||||||
t := terminal.NewTerminal(os.Stdin, p)
|
t := term.NewTerminal(os.Stdin, p)
|
||||||
return t.ReadPassword(p)
|
return t.ReadPassword(p)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user