mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-20 01:32:40 +00:00
26 lines
403 B
Go
26 lines
403 B
Go
package uiUtils
|
|
|
|
import (
|
|
"bufio"
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
func AskForConfirmation(s string) bool {
|
|
reader := bufio.NewReader(os.Stdin)
|
|
|
|
fmt.Printf(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
|
|
}
|