diff options
| author | Paul Buetow <paul@buetow.org> | 2024-10-18 21:10:40 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-10-18 21:10:40 +0300 |
| commit | 84b404e392c94174d1c5ae4feb8afc4f5d334346 (patch) | |
| tree | 19237b127ef441e820dfd98bb4d0725736614093 /internal/prompt | |
| parent | 170a30c7cce4dbe78a20d6379998dcfc41a5c524 (diff) | |
added prompt colors
Diffstat (limited to 'internal/prompt')
| -rw-r--r-- | internal/prompt/prompt.go | 12 |
1 files changed, 11 insertions, 1 deletions
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) |
