comparison cmd/sievemgr/common.go @ 11:29769b9e2f09

Switch to golang.org/x/term module Switch from golang.org/x/crypto/ssh/terminal to the new golang.org/x/term module.
author Guido Berhoerster <guido+sievemgr@berhoerster.name>
date Sat, 12 Dec 2020 20:44:35 +0100
parents 4dff4c3f0fbb
children fc5e6970a0d5
comparison
equal deleted inserted replaced
10:44c07eb8ef08 11:29769b9e2f09
32 "runtime" 32 "runtime"
33 "strings" 33 "strings"
34 34
35 "go.guido-berhoerster.org/managesieve" 35 "go.guido-berhoerster.org/managesieve"
36 "go.guido-berhoerster.org/sievemgr/cmd/sievemgr/internal/config" 36 "go.guido-berhoerster.org/sievemgr/cmd/sievemgr/internal/config"
37 "golang.org/x/crypto/ssh/terminal" 37 "golang.org/x/term"
38 ) 38 )
39 39
40 var errTooBig = errors.New("too big") 40 var errTooBig = errors.New("too big")
41 41
42 func getAccount(conf *config.Configuration, name string) (*config.Account, error) { 42 func getAccount(conf *config.Configuration, name string) (*config.Account, error) {
75 fd = int(tty.Fd()) 75 fd = int(tty.Fd())
76 w = tty 76 w = tty
77 } 77 }
78 78
79 io.WriteString(w, "Password: ") 79 io.WriteString(w, "Password: ")
80 rawPassword, err := terminal.ReadPassword(fd) 80 rawPassword, err := term.ReadPassword(fd)
81 io.WriteString(w, "\n") 81 io.WriteString(w, "\n")
82 if err != nil { 82 if err != nil {
83 return fmt.Errorf("failed to read password: %s", err) 83 return fmt.Errorf("failed to read password: %s", err)
84 } 84 }
85 password := string(rawPassword) 85 password := string(rawPassword)