util.go 294 B

1234567891011121314151617181920
  1. package control
  2. import (
  3. "bufio"
  4. "fmt"
  5. "strings"
  6. log "github.com/Sirupsen/logrus"
  7. )
  8. func yes(in *bufio.Reader, question string) bool {
  9. fmt.Printf("%s [y/N]: ", question)
  10. line, err := in.ReadString('\n')
  11. if err != nil {
  12. log.Fatal(err)
  13. }
  14. return strings.ToLower(line[0:1]) == "y"
  15. }