wujian_develop_tool/util.go

30 lines
381 B
Go

package main
import (
"bufio"
"github.com/fatih/color"
"os"
)
var read = bufio.NewReader(os.Stdin)
func ReadBool() bool {
ret, _ := read.ReadByte()
switch ret {
case 'y':
fallthrough
case 'Y':
return true
case 'n':
fallthrough
case 'N':
return false
}
return false
}
func ReadBoolWithMessage(message string) bool {
color.HiRed(message)
return ReadBool()
}