summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-04 15:29:55 -0500
committerJeff Carr <[email protected]>2025-10-04 15:29:55 -0500
commitfaeb9df79237dc767cfe1f40af14e62c40a01ccd (patch)
tree5e317233f6720196a57e91fdb668437667bdf91c
parentc4af51c5102e763aa08b66bf18af94de0b9f7453 (diff)
get input from STDINv0.0.27
-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 ""
+}