From c3588b695e2dcadf1e30640f0aa7a3c564f429f6 Mon Sep 17 00:00:00 2001 From: Oliver Tzeng Date: Thu, 2 Feb 2023 22:40:19 +0800 Subject: [PATCH] enter --- choose/choose.go | 2 ++ choose/options.go | 1 + 2 files changed, 3 insertions(+) diff --git a/choose/choose.go b/choose/choose.go index 0e898fa..ff21b77 100644 --- a/choose/choose.go +++ b/choose/choose.go @@ -136,7 +136,9 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { // Then we select the item that they have pressed enter on. If they // have selected items, then we simply return them. if m.numSelected < 1 { + if o.AllowUnchoosen == false { m.items[m.index].selected = true + } } return m, tea.Quit } diff --git a/choose/options.go b/choose/options.go index f6ee123..a26fc4f 100644 --- a/choose/options.go +++ b/choose/options.go @@ -8,6 +8,7 @@ type Options struct { Limit int `help:"Maximum number of options to pick" default:"1" group:"Selection"` NoLimit bool `help:"Pick unlimited number of options (ignores limit)" group:"Selection"` + AllowUnchoosen bool `help:"Allow gum choose to proceed when pressing enter without selecting anything" group:"Selection"` Ordered bool `help:"Maintain the order of the selected options" env:"GUM_CHOOSE_ORDERED"` Height int `help:"Height of the list" default:"10" env:"GUM_CHOOSE_HEIGHT"` Cursor string `help:"Prefix to show on item that corresponds to the cursor position" default:"> " env:"GUM_CHOOSE_CURSOR"`