summaryrefslogtreecommitdiff
path: root/questionUser.go
diff options
context:
space:
mode:
Diffstat (limited to 'questionUser.go')
-rw-r--r--questionUser.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/questionUser.go b/questionUser.go
index c212334..f60ebd7 100644
--- a/questionUser.go
+++ b/questionUser.go
@@ -32,3 +32,22 @@ func QuestionUser(msg string) bool {
}
return false
}
+
+func InputFromUser(msg string) string {
+ log.Info(msg)
+ fmt.Fprintf(os.Stdout, "")
+
+ scanner := bufio.NewScanner(os.Stdin)
+ for scanner.Scan() {
+ line := scanner.Text()
+ line = strings.TrimSpace(line)
+ line = strings.ToLower(line)
+ switch line {
+ case "":
+ continue
+ default:
+ return line
+ }
+ }
+ return ""
+}