From 087294f8a555b4ba87f999a4133102cb01de22a4 Mon Sep 17 00:00:00 2001 From: ewy Date: Tue, 14 Apr 2026 17:37:35 +0200 Subject: add reminder when using --yes and remove nighlight from y/n when --yes --- menu/confirm.go | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'menu') diff --git a/menu/confirm.go b/menu/confirm.go index af6c30d..1c6a535 100644 --- a/menu/confirm.go +++ b/menu/confirm.go @@ -6,6 +6,7 @@ import ( "github.com/charmbracelet/lipgloss" "io" "os" + "pik/flags" "pik/menu/style" "pik/model" "slices" @@ -21,11 +22,21 @@ var confirmations = []rune{ var ( PromptColor = lipgloss.Color("1") PromptStyle = style.New(func() lipgloss.Style { - return lipgloss.NewStyle().Foreground(PromptColor) + st := lipgloss.NewStyle() + if !*flags.Yes { + st.Foreground(PromptColor) + } + return st }) ConfirmStyle = style.New(func() lipgloss.Style { return lipgloss.NewStyle() }) + AnswerStyle = style.New(func() lipgloss.Style { + return lipgloss.NewStyle() + }) + YesStyle = style.New(func() lipgloss.Style { + return lipgloss.NewStyle().Faint(true) + }) ) func Confirm(r io.Reader, source *model.Source, target model.Target, args ...string) bool { @@ -35,7 +46,13 @@ func Confirm(r io.Reader, source *model.Source, target model.Target, args ...str "? ", } banner := BannerStyle.Render(parts...) - fmt.Print(banner) + _, _ = fmt.Fprint(os.Stderr, banner) + + if *flags.Yes { + _, _ = fmt.Fprintln(os.Stderr, AnswerStyle.Render("Y", YesStyle.Render("(--yes)"))) + return true + } + scanner := bufio.NewScanner(r) scanner.Split(bufio.ScanRunes) scanner.Scan() -- cgit v1.3