1
0
mirror of https://github.com/rancher/os.git synced 2025-07-24 03:35:18 +00:00
os/util/yes.go
Sven Dowideit dc540a0cf0 get started on the new cli
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-13 12:56:54 +00:00

22 lines
307 B
Go

package util
import (
"bufio"
"fmt"
"os"
"strings"
"github.com/rancher/os/log"
)
func Yes(question string) bool {
fmt.Printf("%s [y/N]: ", question)
in := bufio.NewReader(os.Stdin)
line, err := in.ReadString('\n')
if err != nil {
log.Fatal(err)
}
return strings.ToLower(line[0:1]) == "y"
}