mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-10-22 15:58:44 +00:00
27 lines
443 B
Go
27 lines
443 B
Go
package uiUtils
|
|
|
|
import (
|
|
"bufio"
|
|
"fmt"
|
|
"github.com/up9inc/mizu/cli/mizu"
|
|
"log"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
func AskForConfirmation(s string) bool {
|
|
reader := bufio.NewReader(os.Stdin)
|
|
|
|
fmt.Printf(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
|
|
}
|