comparison cmd/sievemgr/edit.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 8caacf702c0d
children fc5e6970a0d5
comparison
equal deleted inserted replaced
10:44c07eb8ef08 11:29769b9e2f09
31 "runtime" 31 "runtime"
32 "strings" 32 "strings"
33 33
34 "go.guido-berhoerster.org/managesieve" 34 "go.guido-berhoerster.org/managesieve"
35 "go.guido-berhoerster.org/sievemgr/cmd/sievemgr/internal/config" 35 "go.guido-berhoerster.org/sievemgr/cmd/sievemgr/internal/config"
36 "golang.org/x/crypto/ssh/terminal" 36 "golang.org/x/term"
37 ) 37 )
38 38
39 func init() { 39 func init() {
40 cmdEdit.Flag.StringVar(&acctName, "a", "", "Select the account") 40 cmdEdit.Flag.StringVar(&acctName, "a", "", "Select the account")
41 } 41 }
117 return usageError("invalid number of arguments") 117 return usageError("invalid number of arguments")
118 } 118 }
119 119
120 scriptName := args[0] 120 scriptName := args[0]
121 121
122 if !terminal.IsTerminal(int(os.Stdin.Fd())) || 122 if !term.IsTerminal(int(os.Stdin.Fd())) ||
123 !terminal.IsTerminal(int(os.Stdout.Fd())) { 123 !term.IsTerminal(int(os.Stdout.Fd())) {
124 return fmt.Errorf("the edit subcommand can only be used interactively\n") 124 return fmt.Errorf("the edit subcommand can only be used interactively\n")
125 } 125 }
126 126
127 editor := os.Getenv("EDITOR") 127 editor := os.Getenv("EDITOR")
128 if editor == "" { 128 if editor == "" {