aboutsummaryrefslogtreecommitdiff
path: root/pkg/util/util.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/util/util.go')
-rw-r--r--pkg/util/util.go39
1 files changed, 0 insertions, 39 deletions
diff --git a/pkg/util/util.go b/pkg/util/util.go
index 8d2b0bf..8cdf147 100644
--- a/pkg/util/util.go
+++ b/pkg/util/util.go
@@ -21,7 +21,6 @@ package util
import (
"bufio"
"fmt"
- "io"
"os"
"sort"
"strings"
@@ -52,44 +51,6 @@ func FatalIfError(err error) {
var stdin = bufio.NewReader(os.Stdin)
-//Prompt prints the question, then waits for the user to press one of the
-//possible answer keys. Answer keys will automatically be converted to lower
-//case and returned as such.
-//
-// choice := Prompt("(y)es or (n)o", []string{"y","n"})
-// //choice is either "y" or "n"
-func Prompt(out io.Writer, question string, answers []string) string {
- for idx, answer := range answers {
- answers[idx] = strings.ToLower(answer)
- }
-
- out.Write([]byte(">> " + strings.TrimSpace(question) + " "))
- for {
- input, err := stdin.ReadString('\n')
- FatalIfError(err)
- input = strings.TrimSpace(input)
- for _, answer := range answers {
- if strings.ToLower(input) == answer {
- return answer
- }
- }
-
- //user typed gibberish - ask again
- out.Write([]byte("Please type "))
- for idx, answer := range answers {
- if idx > 0 {
- if idx == len(answers)-1 {
- out.Write([]byte(" or "))
- } else {
- out.Write([]byte(", "))
- }
- }
- out.Write([]byte("'" + answer + "'"))
- }
- out.Write([]byte(": "))
- }
-}
-
//ReadLine reads a line from stdin, with whitespace already trimmed.
func ReadLine() string {
input, err := stdin.ReadString('\n')