summaryrefslogtreecommitdiff
path: root/questionUser.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-06 20:08:54 -0500
committerJeff Carr <[email protected]>2025-09-06 20:08:54 -0500
commitb97c502b54ff0f5036cee90287de3af297faab01 (patch)
tree26bad7c448eb2662e9494714ddb5775630364cff /questionUser.go
parentfc6b049b37fc7a282958c2cbca19724a5b8ddc77 (diff)
make Global. duh.v0.0.17
Diffstat (limited to 'questionUser.go')
-rw-r--r--questionUser.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/questionUser.go b/questionUser.go
new file mode 100644
index 0000000..3bba4ae
--- /dev/null
+++ b/questionUser.go
@@ -0,0 +1,30 @@
+package fhelp
+
+import (
+ "bufio"
+ "fmt"
+ "os"
+ "strings"
+
+ "go.wit.com/log"
+)
+
+func QuestionUser(msg string) bool {
+ log.Info(msg)
+ fmt.Fprintf(os.Stdout, "(y)es or (n)o ? ")
+
+ scanner := bufio.NewScanner(os.Stdin)
+ for scanner.Scan() {
+ line := scanner.Text()
+ line = strings.TrimSpace(line)
+ line = strings.ToLower(line)
+ switch line {
+ case "y":
+ return true
+ case "n":
+ return false
+ default:
+ }
+ }
+ return false
+}