TheMathemagicians/sevenkeys/cli/response.go

25 lines
381 B
Go
Raw Normal View History

2024-06-10 15:34:16 +00:00
package cli
import (
"bufio"
2024-06-10 15:34:16 +00:00
"fmt"
"os"
2024-06-10 15:34:16 +00:00
"strings"
)
func GetStringResponse(prompt string) string {
fmt.Print(prompt + " ")
var response string
scanner := bufio.NewScanner(os.Stdin)
scanner.Scan()
response = scanner.Text()
2024-06-10 15:34:16 +00:00
return response
}
func GetYesNoResponse(prompt string) bool {
response := GetStringResponse(prompt)
return strings.ToUpper(response) == "Y"
}