From 84b404e392c94174d1c5ae4feb8afc4f5d334346 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 18 Oct 2024 21:10:40 +0300 Subject: added prompt colors --- internal/prompt/prompt.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'internal/prompt') diff --git a/internal/prompt/prompt.go b/internal/prompt/prompt.go index 0afe98e..9feff70 100644 --- a/internal/prompt/prompt.go +++ b/internal/prompt/prompt.go @@ -6,15 +6,25 @@ import ( "fmt" "os" "strings" + + "github.com/fatih/color" ) var ErrAborted = errors.New("aborted") +var contentSprintf = color.New(color.FgCyan, color.BgBlue, color.Bold).SprintFunc() +var dangerSprintf = color.New(color.FgWhite, color.BgRed, color.Bold).SprintFunc() + +func YesWithContent(question, content string) bool { + fmt.Print(contentSprintf(content)) + fmt.Print("\n") + return Yes(question) +} func Yes(question string) bool { reader := bufio.NewReader(os.Stdin) for { - fmt.Print(question, " (y/n): ") + fmt.Printf("%s ", dangerSprintf(fmt.Sprintf("%s (y/n):", question))) input, err := reader.ReadString('\n') if err != nil { fmt.Println("Error reading input:", err) -- cgit v1.2.3