2024-06-10 15:34:16 +00:00
|
|
|
package cli
|
|
|
|
|
|
|
|
import (
|
2024-06-11 09:08:07 +00:00
|
|
|
"bufio"
|
2024-06-10 15:34:16 +00:00
|
|
|
"fmt"
|
2024-06-11 09:08:07 +00:00
|
|
|
"os"
|
2024-06-10 15:34:16 +00:00
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
func GetStringResponse(prompt string) string {
|
|
|
|
fmt.Print(prompt + " ")
|
|
|
|
|
|
|
|
var response string
|
2024-06-11 09:08:07 +00:00
|
|
|
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"
|
|
|
|
}
|