Remove unused package 'util'
This commit is contained in:
parent
e549d0ec19
commit
0cb344ff1f
6
go.mod
6
go.mod
|
@ -2,13 +2,9 @@ module git.luj0ga.de/franconian/matrix-pretix
|
|||
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
|
||||
maunium.net/go/mautrix v0.11.0
|
||||
)
|
||||
require maunium.net/go/mautrix v0.11.0
|
||||
|
||||
require (
|
||||
golang.org/x/crypto v0.0.0-20220513210258-46612604a0f9 // indirect
|
||||
golang.org/x/net v0.0.0-20220513224357-95641704303c // indirect
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
|
||||
)
|
||||
|
|
4
go.sum
4
go.sum
|
@ -5,10 +5,6 @@ golang.org/x/crypto v0.0.0-20220513210258-46612604a0f9 h1:NUzdAbFtCJSXU20AOXgeqa
|
|||
golang.org/x/crypto v0.0.0-20220513210258-46612604a0f9/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/net v0.0.0-20220513224357-95641704303c h1:nF9mHSvoKBLkQNQhJZNsc66z2UzAMUbLGjC95CF3pU0=
|
||||
golang.org/x/net v0.0.0-20220513224357-95641704303c/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
maunium.net/go/mautrix v0.11.0 h1:B1FBHcvE4Mud+AC+zgNQQOw0JxSVrt40watCejhVA7w=
|
||||
maunium.net/go/mautrix v0.11.0/go.mod h1:K29EcHwsNg6r7fMfwvi0GHQ9o5wSjqB9+Q8RjCIQEjA=
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
package util
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"golang.org/x/term"
|
||||
)
|
||||
|
||||
type Prompter struct {
|
||||
scanner *bufio.Scanner
|
||||
}
|
||||
|
||||
func NewPrompter(scanner *bufio.Scanner) *Prompter {
|
||||
return &Prompter{scanner}
|
||||
}
|
||||
|
||||
func (p Prompter) Prompt(prompt string) (string, error) {
|
||||
printPrompt(prompt)
|
||||
|
||||
if p.scanner.Scan() {
|
||||
return strings.TrimSpace(p.scanner.Text()), nil
|
||||
}
|
||||
|
||||
if err := p.scanner.Err(); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("%s must not be empty", prompt)
|
||||
}
|
||||
|
||||
func PromptForPassword(prompt string) (string, error) {
|
||||
printPrompt(prompt)
|
||||
|
||||
password, err := term.ReadPassword(int(syscall.Stdin))
|
||||
fmt.Fprintln(os.Stderr)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return strings.TrimSpace(string(password)), nil
|
||||
}
|
||||
|
||||
func printPrompt(prompt string) {
|
||||
fmt.Fprint(os.Stderr, prompt, ": ")
|
||||
}
|
Loading…
Reference in New Issue