From 0cb344ff1f88a57783617a09e890e299573cb5b5 Mon Sep 17 00:00:00 2001 From: Luca Date: Sat, 23 Jul 2022 00:34:52 +0200 Subject: [PATCH] Remove unused package 'util' --- go.mod | 6 +---- go.sum | 4 ---- internal/util/prompt.go | 49 ----------------------------------------- 3 files changed, 1 insertion(+), 58 deletions(-) delete mode 100644 internal/util/prompt.go diff --git a/go.mod b/go.mod index aae5cec..b6a08b1 100644 --- a/go.mod +++ b/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 ) diff --git a/go.sum b/go.sum index 1ca47d9..79d9ab1 100644 --- a/go.sum +++ b/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= diff --git a/internal/util/prompt.go b/internal/util/prompt.go deleted file mode 100644 index 65f377c..0000000 --- a/internal/util/prompt.go +++ /dev/null @@ -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, ": ") -}