Files
kubeshark/cli/uiUtils/confirmation.go
Igor Gov f64ee23c74 Introducing new logger, logging debug to file and info to stderr (#134)
* Introducing new logger to file debug and info to stderr
2021-07-25 10:08:37 +03:00

26 lines
440 B
Go

package uiUtils
import (
"bufio"
"github.com/up9inc/mizu/cli/mizu"
"log"
"os"
"strings"
)
func AskForConfirmation(s string) bool {
reader := bufio.NewReader(os.Stdin)
mizu.Log.Infof(mizu.Magenta, s)
response, err := reader.ReadString('\n')
if err != nil {
log.Fatal(err)
}
response = strings.ToLower(strings.TrimSpace(response))
if response == "" || response == "y" || response == "yes" {
return true
}
return false
}