2022-01-05 20:25:29 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bufio"
|
2022-01-06 00:19:22 +08:00
|
|
|
"github.com/fatih/color"
|
2022-01-05 20:25:29 +08:00
|
|
|
"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
|
|
|
|
}
|
2022-01-06 00:19:22 +08:00
|
|
|
|
|
|
|
func ReadBoolWithMessage(message string) bool {
|
|
|
|
color.HiRed(message)
|
|
|
|
return ReadBool()
|
|
|
|
}
|