25 lines
381 B
Go
25 lines
381 B
Go
package cli
|
|
|
|
import (
|
|
"bufio"
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
func GetStringResponse(prompt string) string {
|
|
fmt.Print(prompt + " ")
|
|
|
|
var response string
|
|
scanner := bufio.NewScanner(os.Stdin)
|
|
scanner.Scan()
|
|
response = scanner.Text()
|
|
|
|
return response
|
|
}
|
|
|
|
func GetYesNoResponse(prompt string) bool {
|
|
response := GetStringResponse(prompt)
|
|
return strings.ToUpper(response) == "Y"
|
|
}
|